Logo ExamsQA
Exit
Free 0/10
1
Question

Which of the following code snippets is correct? (Choose 2)

Select 2
Options
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(); }

2
Question

What is the return value of the following code? strpos("me myself and I", "m", 2)

Options
A

2

B

3

C

4

D

0

E

1

3
Question

Which of the following superglobals does not necessarily contain data from the client?

Options
A

$_POST

B

$_SESSION

C

$_GET

D

$_SERVER

4
Question

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'?

Options
A

$datetime->format('%Y-%m-%d %h:%i:%s')

B

$datetime->format('%Y-%m-%d %h:%i:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))

C

$datetime->format('Y-m-d H:i:s')

D

$date = date('Y-m-d H:i:s', $datetime);

5
Question

What is the output of the following code? echo '1' . (print '2') + 3;

Options
A

123

B

213

C

142

D

214

E

Syntax error

6
Question

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);

Options
A

4

B

5

C

8

D

None of the above

7
Question

What is the output of the following code? $first = "second"; $second = "first"; echo $$$first;

Options
A

"first"

B

"second"

C

an empty string

D

an error

8
Question

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)

Select 2
Options
A

The transaction failed

B

The transaction affected no lines

C

The transaction was rolled back

D

The transaction was committed without error

9
Question

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)

Select 2
Options
A

echo $xml->books->book[2];

B

echo $xml->books->book[1];

C

echo $xml->book[1];

D

echo $xml->xpath("/books/book[@id=2]");

E

$c = $xml->children(); echo $c[1];

10
Question

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() . ','; }

Options
A

An error

B

1,1,1,1,1,1,1,1,1,1,

C

1,1,2,3,5,8,13,21,34,55,

D

Nothing