Which of the following statements about PHP is true? (Choose 3)
a) A final class can be derived.
b) A final class may be instantiated.
c) A class with a final function may be derived.
d) Static functions can be final.
e) Properties can be final.
What will the $array array contain at the end of this script?
1
2 function modifyArray (&$array)
3 {
4 foreach ($array as &$value)
5 {
6 $value = $value + 1;
7 }
8
9 $value = $value + 2;
10 }
11
12 $array = array (1, 2, 3);
13 modifyArray($array);
14 ?>
Which of the following rules must every correct XML document adhere to? (Choose 2)
Is the following code piece E_STRICT compliant?
final class Testing {
var $test = 0;
public function tester() {
return "Tested!";
}}
What is the output of the following code?
$first = "second";
$second = "first";
echo $$$first;
An HTML form contains this form element:
When this form is submitted, the following PHP code gets executed:
1
2 move_uploaded_file(
3 $_FILES['myFile']['tmp_name'],
4 'uploads/' . $_FILES['myFile']['name']);
5 ?>
Which of the following actions must be taken before this code may go into production?
(Choose 2)
What is the output of the following script?
1
2 function fibonacci ($x1, $x2)
3 {
4 return $x1 + $x2;
5 }
6
7 $x1 = 0;
8 $x2 = 1;
9
10 for ($i = 0; $i < 10; $i++) {
11 echo fibonacci($x1, $x2) . ',';
12 }
13 ?>
What will be the result of the following operation?
array_combine(array("A","B","C"), array(1,2,3));
Which of the following statements about Reflection are correct? (Choose 2)
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
Which is the most secure approach for handling dynamic data in SQL queries?
You want to run the following PHP 4 code with PHP 5. In the following example, which access modifier in PHP 5 is equivalent to "var"?
class Test {
var $tester;
}
What super-global should be used to access information about uploaded files via a POST request?
What DOMElement method should be used to check for availability of a non-namespaced attribute?
You have a variable $test that contains sub-strings divided by a dash ("-"). How can you put every sub-string into an array element easily?
You need to escape special characters to use user input inside a regular expression. Which functions would you use? (Choose 2)
What is the output of the following code?
1
2 function append($str)
3 {
4 $str = $str.'append';
5 }
6
7 function prepend(&$str)
8 {
9 $str = 'prepend'.$str;
10 }
11
12 $string = 'zce';
13 append(prepend($string));
14 echo $string;
15 ?>
What will the following code print?
echo addslashes('I am a small "HTML" string, which is
\'invalid\'.');
What will the following code piece print?
echo strtr('Apples and bananas', 'ae', 'ea')
You analyze the code of a colleague and see a call to the function quotemeta(). You give the string "Holy $%&[. What's going on?" as a parameter to it. What will it output?
Which elements does the array returned by the function pathinfo() contain?