-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathbasics.yml
More file actions
67 lines (64 loc) · 2.66 KB
/
basics.yml
File metadata and controls
67 lines (64 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
category: Basics
questions:
-
question: 'Which of the following tags are an acceptable way to begin a PHP code block?'
answers:
- {value: '<SCRIPT LANGUAGE="php">', correct: false}
- {value: '<!', correct: false}
- {value: '<%', correct: false}
- {value: '<?', correct: true}
-
question: 'Which of the following are valid PHP variables?'
answers:
- {value: '@$foo', correct: true}
- {value: '&$variable', correct: true}
- {value: '${0x0}', correct: false}
- {value: '$0x0', correct: false}
-
question: 'What is the best way to iterate and modify every element of an array using PHP?'
answers:
- {value: 'You cannot modify an array during iteration.', correct: false}
- {value: 'for ($i = 0; $i < count($array); $i++) { /* ... * / }', correct: false}
- {value: 'foreach ($array as $key => &$val) { /* ... * / }', correct: true}
- {value: 'foreach ($array as $key => $val) { /* ... * / }', correct: false}
- {value: 'while (list($key, $val) = each($array)) { /* ... * / }', correct: false}
-
question: |
What is the output of the following PHP code?
define("FOO", 10);
$array = [10 => FOO, "FOO" => 20];
echo $array[$array[FOO]] * $array["FOO"];
answers:
- {value: 'FOO', correct: false}
- {value: 100, correct: false}
- {value: 200, correct: true}
- {value: 20, correct: false}
- {value: 10, correct: false}
-
question: |
What is the output of the following PHP script?
$a = 1;
$b = 2.5;
$c = 0xFF;
$d = $b + $c;
$e = $d * $b;
$f = ($d + $e) % $a;
echo ($f + $e);
answers:
- {value: 643.75, correct: true}
- {value: 432, correct: false}
- {value: 643, correct: false}
- {value: 257, correct: false}
- {value: 432.75, correct: false}
-
question: |
What is the output of the following?
$a = 010;
$b = 0xA;
$c = 2;
echo $a + $b + $c;
answers:
- {value: '20', correct: true}
- {value: '22', correct: false}
- {value: '$a is an invalid value', correct: false}
- {value: '2', correct: false}