3 Months Free Update
3 Months Free Update
3 Months Free Update
When PHP is running on a command line, what super-global will contain the command line arguments specified?
Which of the following functions are used to escape data within the context of HTML?
(Choose 2)
Which PHP function is used to validate whether the contents of $_FILES['name'] ['tem_name'] have really been uploaded via HTTP'?
What can prevent PHP from being able to open a file on the hard drive (Choose 3)?
In the following code, which class can be instantiated?
1
2 abstract class Graphics {
3 abstract function draw($im, $col);
4 }
5
6 abstract class Point1 extends Graphics {
7 public $x, $y;
8 function __construct($x, $y) {
9 $this->x = $x;
10 $this->y = $y;
11 }
12 function draw($im, $col) {
13 ImageSetPixel($im, $this->x, $this->y, $col);
14 }
15 }
16
17 class Point2 extends Point1 { }
18
19 abstract class Point3 extends Point2 { }
20 ?>
Given the following code, what is correct?
function f(stdClass &$x = NULL) { $x = 42;
}
$z = new stdClass;
f($z);
var_dump($z);
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 is the error in the following declaration of a static class method?
1
2 class car {
3 static $speeds = array(
4 'fast',
5 'slow',
6 'medium',
7 );
8
9 static function getSpeeds()
10 {
11 return $this->speeds;
12 }
13 }
14 ?>
After executing a query on a database server, PHP offers several functions to read the resulting lines, such as mysqli_fetch_assoc, pg_fetch_row, oci_fetch,etc.). If such functions do not return any rows, it means: (Choose 2)
You want to allow your users to submit HTML code in a form, which will then be displayed as real code and not affect your site layout. Which function do you apply to the text, when displaying it? (Choose 2)
Which of the following function signatures is correct if you want to have classes automatically loaded?
Which of the following statements is NOT true?
a) Class constants are public
b) Class constants are being inherited
c) Class constants can omit initialization (default to NULL)
d) Class constants can be initialized by consts
You want to parse a URL into its single parts. Which function do you choose?
What is the output of the following code?
$first = "second";
$second = "first";
echo $$$first;
What method can be used to find a tag with the name "foo" via the DOM extension?
What visibility denies access to properties and methods outside of the class?
An HTML form contains this form element
When this form is submitted, the following PHP code gets executed:
move_uploaded_file(
$_FILES['myFile']['tmp_name'],
'uploads/' . $_FILES['myFile']['name']);
Which of the following actions must be taken before this code may go into production?
(Choose 2)
Which of these protocols are NOT governed by the W3C in their latest versions? (Choose 2)
Which of the following data types cannot be directly manipulated by the client?
Which is the most secure approach for handling dynamic data in SQL queries?
Which of the listed changes would you make to the following PHP 4 code in order to make it most compliant with PHP 5? (Choose 2)
class Car {
var $model;
function Car($model) {
$this->model = $model;
} function toString() {
return "I drive a $this->model.";
}}
$c = new Car('Dodge');
echo $c->toString();
?>
How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object found inside $xml?
What will be the output value of the following code?
$array = array(1,2,3);
while (list(,$v) = each($array));
var_dump(current($array));
What function can reverse the order of values in an array without the loss of key information?
Which of the following code snippets is correct? (Choose 2)
a)
interface Drawable {
abstract function draw();
}
b)
interface Point {
function getX();
function getY();
}
c)
interface Line extends Point {
function getX2();
function getY2();
}
d)
interface Circle implements Point {
function getRadius();
}
Consider the following code. What can be said about the call to file_get_contents?
How many elements does the array $pieces contain after the following piece of code has been executed?
$pieces = explode("/", "///");
How do you allow the caller to submit a variable number of arguments to a function?
What is the output of the following code:
str_replace(array("Apple","Orange"), array("Orange","Apple"), "Oranges are orange and Apples are green");
A/hen comparing prepared statements and regular, application-constructed SQL statements, which of the following is true?
Your application needs to handle file uploads performed with HTTP PUT. How can you retrieve this data?
Which is the most efficient way to determine if a key is present in an array, assuming the array has no NULL values?
The following form is loaded in a recent browser and submitted, with the second list element selected:
In the server-side PHP code to deal with the form data, what is the value of $_POST ['list']?
Would the following code catch a parse error?
try {
echo $label
} catch (Exception $e) {
echo $e->getMessage();
}
After performing the following operations:
$a = array('a', 'b', 'c');
$a = array_keys(array_flip($a));
What will be the value of $a?
What will the following function call return?
strstr('http://example.com/test/file.php ', '/');
How many elements does the $matches array contain after the following function call is performed?
preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=200[0-9])/', '21st March
2006', $matches);
Which of the following filtering techniques prevents cross-site scripting (XSS) vulnerabilities?
What is the output of the following code?
class test {
public $value = 0;
function test() {
$this->value = 1;
} function __construct() {
$this->value = 2;
}}
$object = new test();
echo $object->value;
One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?
What will be the value of $b after running the following code?
$a = array('c', 'b', 'a');
$b = (array)$a;
What is the output of the following code?
echo 0x33, ' monkeys sit on ', 011, ' trees.';