ZEND PHP Quiz Questions and Answers

You'd like to use the class MyDBConnection that's defined in the MyGreatFrarnework\GreafDatabaseAbstractionLayer namespace, but you want to minimize *as much as possible* the length of the class name you have to type. What would you do?

Answer :
  •  Import the MyGreatFrarnework\GreafDatabaseAbstractionLayer namespace

Which of the following describes a PHP extension?

Answer :
  • A plugin that changes the way PHP behaves

What is the output of the following code ? $a = 1; ++$a; $a *=$a; echo --$a;

Answer :
  • 3

What is the output of the following code? $a = 'a'; $b = 'b'; echo isset($c) ? $a.$b.$c : ($c = 'c').'d';

Answer :
  • cd

What is the result of the following bitwise operation in PHP? 1 ^ 2

Answer :
  • 3

What is the output of the following code? function increment ($val) { $val = $val + 1; } $val = 1; increment ($val); echo $val;

Answer :
  • 1

Which of the following is NOT true about PHP traits?

Answer :
  • A trait can implement an interface.

What is the output of the following code? $a = array('a', 'b'= >'c'); echo property_exists((object) $a, 'a')?'true':'false'; echo '-'; echo property_exists((object) $a, 'b')?'true':'false'

Answer :
  • false-true

What is the output of the following code? class Bar { private $a = 'b'; public $c = 'd'; } $x = (array) new Bar(); echo array_key_exists('a', $x) ? 'true' : 'false'; echo '-'; echo array_key_exists('c', $x) ? 'true' : 'false';

Answer :
  • false-true

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

Answer :
  • B and D