Weekend Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

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

A.

4

B.

5

C.

8

D.

None of the above

What happens if you try to access a property whose name is defined in a parent class as private, and is not declared in the current class?

A.

An E_NOTICE error will be triggered.

B.

An E_ERROR error will be triggered.

C.

An E_WARNING error will be triggered.

D.

No errors will be triggered

What is the file locking mode that should be used when writing to a file?

A.

LOCK_UN

B.

LOCK_SH

C.

LOCK_EX

D.

LOCK_NB

Which of the following rules must every correct XML document adhere to? (Choose 2)

A.

It has to be well-formed.

B.

It has to be valid.

C.

It has to be associated to a DTD.

D.

It may only contain UTF-8 encoded characters.

Which of the following may be used in conjunction with CASE inside a SWITCH statement?

A.

A scalar

B.

An expression

C.

A boolean

D.

All of the above

Under which circumstances is the $_SESSION super-global available? (Choose 2)

A.

If session_start() was called.

B.

If session.auto_start INI setting is enabled.

C.

Always available in PHP 5.

D.

If a valid session id is passed via GET, POST or COOKIE.

E.

If register_globals are enabled.

You need to escape special characters to use user input inside a regular expression. Which functions would you use? (Choose 2)

A.

addslashes()

B.

htmlentities()

C.

preg_quote()

D.

regex_quote()

E.

quotemeta()

What is the result of the following code:

class T

{ const A

=

42 + 1;

}

echo T::A;

A.

42

B.

43

C.

Parse error

The following code piece should print "PHP is cool", but unexpectedly, it just prints "cool". How would you correct it?

echo str_replace('PHP is a pain.', 'a pain', 'cool');

A.

str_replace('PHP is a pain.', 'cool', 'a pain');

B.

str_replace('a pain', 'cool', 'PHP is a pain.');

C.

str_replace('cool', 'a pain', 'PHP is a pain.');

Consider the following XML code:

PHP 5 Power Programming

Learning PHP 5

Which of the following SimpleXML calls print the name of the second book?

(Let $xml=simplexml_load_file("books.xml");) (Choose 2)

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