Generated with: ZCE Chrome Extension
Question 1
Fill in the blank with the appropriate word. The ________ operator lets a programmer inspect all of
the ancestor classes of the object, as well as any interfaces.
is_an
instanceof
type-hint
instance of
_______________________________________________________________________________________________________________
1 / 11
Generated with: ZCE Chrome Extension
Question 2
How would you change a SimpleXMLElement object into a DOMElement? (choose two)
using simplexml_export_dom()
convert SimpleXMLElement to XML, then create a DOMElement from the XML
using dom_import_simplexml()
SimpleXMLElement::asDom()
_______________________________________________________________________________________________________________
2 / 11
Generated with: ZCE Chrome Extension
Question 3
Consider the following PHP code:
<?= strlen(md5(rand(),TRUE));
64
32
16
_______________________________________________________________________________________________________________
3 / 11
Generated with: ZCE Chrome Extension
Question 4
Which of the following are NOT valid ways to embed a variable into a string?
$a = "Value: $value->getValue()";
$a = 'Value: $value';
$a = "Value: {$value}";
$a = "Value: $value";
_______________________________________________________________________________________________________________
4 / 11
Generated with: ZCE Chrome Extension
Question 5
Which of the following is used to convert a scalar value into a single-quote delimited string that
can be used safely as a single argument for a shell command?
mysql_real_escape_string()
escapeshellarg()
mysql_escape_string()
escapeshellcmd()
_______________________________________________________________________________________________________________
5 / 11
Generated with: ZCE Chrome Extension
Question 6
Which of the following functions returns current Unix timestamp?
time()
localtime()
date()
strtotime()
_______________________________________________________________________________________________________________
6 / 11
Generated with: ZCE Chrome Extension
Question 7
In the following code, what are the values required in $a, $b, $c and $d to output 40?
$values = array(
array(
1 => 10,
20,
array(30, array(40))
),
array(
2 => 50,
array(
array(1 => 60, 0 => 70)
)
)
);
echo $values[$a][$b][$c][$d];
$a = 0, $b = 3, $c = 1, $d = 0
$a = 0, $b = 1, $c = 1, $d = 0
$a = 1, $b = 3, $c = 1, $d = 0
$a = 0, $b = 1, $c = 0, $d = 0
_______________________________________________________________________________________________________________
7 / 11
Generated with: ZCE Chrome Extension
Question 8
How does Opcode Cache improve performance in PHP 5.5+ ?
Opcode does`not exist in php
Opcode Cache stores database query results thus eliminating the need of executing those queries again
Opcode Cache stores objects in memory so that they can be accessed directly by other processes.
Opcache stores precompiled script bytecode in memory, thus removing the need to load and parse scripts on each request.
_______________________________________________________________________________________________________________
8 / 11
Generated with: ZCE Chrome Extension
Question 9
You want to send an HTTP cookie without URL encoding the cookie value. Which of the following
functions will you use?
setrawcookie()
headers_list()
headers_sent()
setcookie()
_______________________________________________________________________________________________________________
9 / 11
Generated with: ZCE Chrome Extension
Question 10
One way to compare strings in PHP is by using the strcmp() function. This is useful since not
only can you determine if two strings are equal, but you can also test if one string is 'greater than'
the other (using the corresponding ASCII values in each character comparison). What is the
output of the following PHP script?
$test1 = strcmp('hello', "hello");
$test2 = strcmp("Hello", "hello");
$test3 = strcmp('60', '500');
if ($test1 == 0) { echo "a"; }
else if ($test1 < 0) { echo "b"; }
else { echo "c"; }
if ($test2 == 0) { echo "d"; }
else if ($test2 < 0) { echo "e"; }
else { echo "f"; }
if ($test3 == 0) { echo "g"; }
else if ($test3 < 0) { echo "h"; }
else { echo "i"; }
Enter the exact script output
bei
iuo
aei
_______________________________________________________________________________________________________________
10 / 11
Generated with: ZCE Chrome Extension
Answers
Answer for Question 1
B
Answer for Question 2
C
Answer for Question 3
D
Answer for Question 4
A,B
Answer for Question 5
B
Answer for Question 6
A
Answer for Question 7
A
Answer for Question 8
D
Answer for Question 9
A
Answer for Question 10
D
_______________________________________________________________________________________________________________
11 / 11