Which of the following code snippets is correct? (Choose 2)
interface Drawable { abstract function draw(); }
interface Point { function getX(); function getY(); }
interface Line extends Point { function getX2(); function getY2(); }
interface Circle implements Point { function getRadius(); }
What is the return value of the following code? strpos("me myself and I", "m", 2)
2
3
4
0
1
Which of the following superglobals does not necessarily contain data from the client?
$_POST
$_SESSION
$_GET
$_SERVER
Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'?
$datetime->format('%Y-%m-%d %h:%i:%s')
$datetime->format('%Y-%m-%d %h:%i:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))
$datetime->format('Y-m-d H:i:s')
$date = date('Y-m-d H:i:s', $datetime);
What is the output of the following code? echo '1' . (print '2') + 3;
123
213
142
214
Syntax error
What will be the output of the following code? $a = array(0, 1, 2 => array(3, 4)); $a[3] = array(4, 5); echo count($a, 1);
4
5
8
None of the above
What is the output of the following code? $first = "second"; $second = "first"; echo $$$first;
"first"
"second"
an empty string
an error
When a query that is supposed to affect rows is executed as part of a transaction, and reports no affected rows, it could mean that: (Choose 2)
The transaction failed
The transaction affected no lines
The transaction was rolled back
The transaction was committed without error
Consider the following XML code: <?xml version="1.0" encoding="utf-8"?> <books> <book id="1">PHP 5.5 in 42 Hours</book> <book id="2">Learning PHP 5.5 The Hard Way</book> </books> Which of the following SimpleXML calls prints the name of the second book? (Let $xml = simplexml_load_file("books.xml"); .) (Choose 2)
echo $xml->books->book[2];
echo $xml->books->book[1];
echo $xml->book[1];
echo $xml->xpath("/books/book[@id=2]");
$c = $xml->children(); echo $c[1];
What is the output of the following code? function fibonacci (&$x1 = 0, &$x2 = 1) { $result = $x1 + $x2; $x1 = $x2; $x2 = $result; return $result; } for ($i = 0; $i < 10; $i++) { echo fibonacci() . ','; }
An error
1,1,1,1,1,1,1,1,1,1,
1,1,2,3,5,8,13,21,34,55,
Nothing