Summer Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ecus65

Zend 200-550 - Zend Certified PHP Engineer

Page: 3 / 7
Total 223 questions

When would you use classes and when would you use namespaces?

A.

Use classes to encapsulate code and represent objects, and namespaces to avoid symbol name collisions

B.

Use classes for performance-sensitive code, and namespaces when readability matters more

C.

Use namespaces for performance-sensitive code, and classes when readability matters more

D.

Always use them; namespaces are always superior to classes

Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)

A.

PHP_AUTH_TYPE

B.

PHP_AUTH_PASSWORD

C.

PHP_AUTH_DIGEST

D.

PHP_AUTH_PW

E.

PHP_AUTH_USER

Transactions should be used to: (Choose 2)

A.

Prevent errors in case of a power outage or a failure in the SQL connection

B.

Ensure that the data is properly formatted

C.

Ensure that either all statements are performed properly, or that none of them are.

D.

Recover from user errors

What is the output of the following code?

function increment ($val)

{

$val = $val + 1;

}

$val = 1;

increment ($val);

echo $val;

Which of the following statements about PHP is false? (Choose 2)

A.

A final class can be derived.

B.

A final class may be instantiated.

C.

A class with a final function may be derived.

D.

Static functions can be final.

E.

Properties can be final.

Which string will be returned by the following function call?

$test = '/etc/conf.d/wireless';

substr($test, strrpos($test, '/')); // note that strrpos() is being called, and not strpos()

A.

""

B.

"/wireless"

C.

"wireless"

D.

"/conf.d/wireless"

E.

"/etc"

Which of the following can NOT be used to send a cookie from within a PHP application?

A.

header()

B.

$_COOKIE

C.

setcookie()

D.

setrawcookie()

In the following code, which line should be changed so it outputs the number 2:

class A {

protected $x = array(); /* A */

public function getX() { /* B */

return $this->x; /* C */

}

}

$a = new A(); /* D */

array_push($a->getX(), "one");

array_push($a->getX(), "two");

echo count($a->getX());

A.

No changes needed, the code would output 2 as is

B.

Line A, to: protected &$x = array();

C.

Line B, to: public function &getX() {

D.

Line C, to: return &$this->x;

E.

Line D, to: $a =& new A();

What will the following code print out?

$str = '✔ one of the following';

echo str_replace('✔', 'Check', $str);

A.

Check one of the following

B.

one of the following

C.

✔ one of the following

Which of the following techniques ensures that a value submitted in a form can only be yes or no ?

A.

Use a select list that only lets the user choose between yes and no .

B.

Use a hidden input field that has a value of yes or no .

C.

Enable the safe_mode configuration directive.

D.

None of the above.