Zend Certified PHP Engineer v6.0 (200-550)

Page:    1 / 15   
Total 223 questions

Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2)
$obj = new C();
foreach ($obj as $x => $y) {
echo $x, $y;

  • A. Iterator
  • B. ArrayAccess
  • C. IteratorAggregate
  • D. ArrayObject


Answer : A,C

What is the output of the following code?
class Foo Implements ArrayAccess {
function offsetExists($k) { return true;}
function offsetGet($k) {return 'a';}
function offsetSet($k, $v) {}
function offsetUnset($k) {}
$x = new Foo();
echo array_key_exists('foo', $x)?'true':'false';

  • A. true
  • B. false


Answer : B

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

  • A. false-false
  • B. false-true
  • C. true-false
  • D. true-true


Answer : B

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

  • A. false-false
  • B. false-true
  • C. true-false
  • D. true-true


Answer : B

Assuming UTF-8 encoding, what is the value of $count?
$data = '$12';
$count = strlen($data);

  • A. 0
  • B. 4
  • C. 5
  • D. 7


Answer : C

What is the output of this code?
$world = 'world';
echo <<<'TEXT'
hello $world
TEXT;

  • A. hello world
  • B. hello $world
  • C. PHP Parser error


Answer : C

Given a php.ini setting of -
default_charset = utf-8
what will the following code print in the browser?
header('Content-Type: text/html; charset=iso-8859-1');
echo '✂✔✝';

  • A. Three Unicode characters, or unreadable text, depending on the browser
  • B. ✂✔✝
  • C. A blank line due to charset mismatch


Answer : 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


Answer : A

What is the pattern modifier for handling UTF-8 encoded preg_* functionality?

  • A. e
  • B. u
  • C. PHP does not support UTF-8 encoded strings
  • D. A pattern modifier is not needed


Answer : B

What is the output of the following code?
$text = 'This is text';
$text1 = <<<'TEXT'
$text
TEXT;
$text2 = <<<TEXT
$text1
TEXT;
echo "$text2";

  • A. This is text
  • B. $text
  • C. $text1
  • D. $text2


Answer : B

Your public web application needs to provide access to binary files for registered users only. How would you achieve this?

  • A. Host the files on a public external file sharing service.
  • B. Redirect to the file which resides in the server's document root
  • C. Use PHP to send the file to the client, using the header() function to set appropriate HTTP headers
  • D. PHP is used for service HTML content, not binary content


Answer : C

What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?

  • A. application/x-www-form-urlencoded
  • B. http/post
  • C. text/html
  • D. object/multipart-formdata


Answer : A

From your PHP application, how can you send the same header twice, but with different values?

  • A. Set the second argument of the header() function to false
  • B. PHP does that automatically
  • C. You may only send a particular type of header once
  • D. Use the header_add() function


Answer : A

Which class of HTTP status codes is used for server error conditions?

  • A. 2XX
  • B. 3XX
  • C. 4XX
  • D. 5XX


Answer : D

Which class of HTTP status codes is used for redirections?

  • A. 2XX
  • B. 3XX
  • C. 4XX
  • D. 5XX


Answer : B

Page:    1 / 15   
Total 223 questions