Weekend Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: cramtreat

200-550 Zend Certified PHP Engineer Questions and Answers

Questions 4

Which of these statements about PDO is NOT true?

Options:

A.

PDO has built-in support for Large Objects (LOBs).

B.

Placeholders within PDO prepared statements need to be named.

C.

When something goes wrong, PDO can throw an instance of its own exception class.

D.

PDO does not emulate missing database features.

Buy Now
Questions 5

How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object

found inside $xml?

One

Two

Options:

A.

$xml->getElementById('2');

B.

$xml->foo->bar->baz[2]['id']

C.

$xml->foo->baz[2]['id']

D.

$xml->foo->bar->baz[1]['id']

E.

$xml->bar->baz[1]['id']

Buy Now
Questions 6

What is the name of the method that can be used to provide read access to virtual properties in a class?

Options:

A.

__call()

B.

__get()

C.

__set()

D.

__wakeup()

E.

__fetch()

Buy Now
Questions 7

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 '✂✔✝';

Options:

A.

Three Unicode characters, or unreadable text, depending on the browser

B.

✂✔✝

C.

A blank line due to charset mismatch

Buy Now
Questions 8

Consider the following table data and PHP code. What is a possible outcome?

Table data (table name "users" with primary key "id"):

id name email

------- ----------- -------------------

1 anna alpha@example.com

2 betty beta@example.org

3 clara gamma@example.net

5 sue sigma@example.info

PHP code (assume the PDO connection is correctly established):

$dsn = 'mysql:host=localhost;dbname=exam';

$user = 'username';

$pass = '********';

$pdo = new PDO($dsn, $user, $pass);

$cmd = "SELECT name, email FROM users LIMIT 1";

$stmt = $pdo->prepare($cmd);

$stmt->execute();

$result = $stmt->fetchAll(PDO::FETCH_BOTH);

$row = $result[0];

Options:

A.

The value of $row is `array(0 => 'anna', 1 => 'alpha@example.com')`.

B.

The value of $row is `array('name' => 'anna', 'email' => 'alpha@example.com')`.

C.

The value of $row is `array(0 => 'anna', 'name' => 'anna', 1 => 'alpha@example.com', 'email' => 'alpha@example.com')`.

D.

The value of $result is `array('anna' => 'alpha@example.com')`.

Buy Now
Questions 9

Which of the following statements about anonymous functions in PHP are NOT true? (Choose 2)

Options:

A.

Anonymous functions can be bound to objects

B.

Anonymous functions created within object context are always bound to that object

C.

Assigning closure to a property of an object binds it to that object

D.

Methods bind() and bindTo() of the Closure object provide means to create closures with different binding and scope

E.

Binding defines the value of $this and the scope for a closure

Buy Now
Questions 10

Which sentence describes the following regular expression match?

preg_match('/^\d+(?:\.[0-9]+)?$/', $test);

Options:

A.

It matches float numbers with thousand seperators.

B.

It matches float numbers without thousand seperators.

C.

It matches binary integer numbers.

D.

It matches any string.

E.

It does not match anything

Buy Now
Questions 11

Which one of the following XML declarations is NOT valid?

Options:

A.

B.

C.

D.

Buy Now
Questions 12

What is the output of the following code?

function increment ($val)

{

$val = $val + 1;

}

$val = 1;

increment ($val);

echo $val;

Options:

Buy Now
Questions 13

Which of the following is used to find all PHP files under a certain directory?

Options:

A.

PHPIterator

B.

RecursiveTreeIterator

C.

RecursiveDirectoryIterator

D.

SplTempFileObject

Buy Now
Questions 14

Which line of code can be used to replace the INSERT comment in order to output "hello"?

class C {

public $ello = 'ello';

public $c;

public $m;

function __construct($y) {

$this->c = static function($f) {

// INSERT LINE OF CODE HERE

};

$this->m = function() {

return "h";

};

}

}

$x = new C("h");

$f = $x->c;

echo $f($x->m);

Options:

A.

return $this->m() . "ello";

B.

return $f() . "ello";

C.

return "h". $this->ello;

D.

return $y . "ello";

Buy Now
Questions 15

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

Buy Now
Questions 16

Which SPL class implements fixed-size storage?

Options:

Buy Now
Questions 17

An HTML form contains this form element:

When this form is submitted, the following PHP code gets executed:

move_uploaded_file(

$_FILES['myFile']['tmp_name'],

'uploads/' . $_FILES['myFile']['name']

);

Which of the following actions must be taken before this code may go into production? (Choose 2)

Options:

A.

Check with is_uploaded_file() whether the uploaded file $_FILES['myFile']['tmp_name'] is valid

B.

Sanitize the file name in $_FILES['myFile']['name'] because this value is not consistent among web browsers

C.

Check the charset encoding of the HTTP request to see whether it matches the encoding of the uploaded file

D.

Sanitize the file name in $_FILES['myFile']['name'] because this value could be forged

E.

Use $HTTP_POST_FILES instead of $_FILES to maintain upwards compatibility

Buy Now
Questions 18

What is the name of the function that allows you register a set of functions that implement user-defined session handling?

Options:

A.

session_set_handler()

B.

session_set_storage_handler()

C.

session_register_handler()

D.

session_set_save_handler()

Buy Now
Questions 19

When a class is defined as final it:

Options:

A.

Can no longer be extended by other classes.

B.

Means methods in the class are not over-loadable.

C.

Cannot be defined as such, final is only applicable to object methods.

D.

Cannot be instantiated.

Buy Now
Questions 20

The following form is loaded in a browser and submitted, with the checkbox activated:

In the server-side PHP code to deal with the form data, what is the value of $_POST['accept'] ?

Options:

A.

accept

B.

ok

C.

true

D.

on

Buy Now
Questions 21

Transactions should be used to: (Choose 2)

Options:

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

Buy Now
Questions 22

What is the output of the following code?

class Base {

protected static function whoami() {

echo "Base ";

}

public static function whoareyou() {

static::whoami();

}

}

class A extends Base {

public static function test() {

Base::whoareyou();

self::whoareyou();

parent::whoareyou();

Options:

A.

:whoareyou();

static::whoareyou();

}

public static function whoami() {

echo "A ";

}

}

class B extends A {

public static function whoami() {

echo "B ";

}

}

B.

:test();

C.

B B B B B

D.

Base A Base A B

E.

Base B B A B

F.

Base B A A B

Buy Now
Questions 23

What DOMElement method should be used to check for availability of a non-namespaced attribute?

Options:

A.

getAttributeNS()

B.

getAttribute()

C.

hasAttribute()

D.

hasAttributeNS()

Buy Now
Questions 24

Which of the following statements are FALSE?

Options:

A.

SimpleXML allows removal of attributes.

B.

SimpleXML allows addition of new attributes.

C.

SimpleXML allows removal of nodes.

D.

SimpleXML allows addition of new nodes.

E.

None of the above

Buy Now
Questions 25

In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)

Options:

A.

SplFixedArray

B.

SplObjectStorage

C.

SplString

D.

spl_object_hash

E.

spl_same_object

Buy Now
Questions 26

What is the output of the following code?

$a = 3;

switch ($a) {

case 1: echo 'one'; break;

case 2: echo 'two'; break;

default: echo 'four'; break;

case 3: echo 'three'; break;

}

Options:

A.

one

B.

two

C.

three

D.

four

Buy Now
Questions 27

Type hinting in PHP allows the identification of the following variable types: (Choose 2)

Options:

A.

String

B.

Integer

C.

Array

D.

Any class or interface type

E.

All of the above

Buy Now
Questions 28

Consider the following code. What can be said about the call to file_get_contents?

$getdata = "foo=bar";

$opts = array('http' =>

array(

'method' => 'POST',

'header' => 'Content-type: application/x-www-form-urlencoded',

'content' => $getdata

)

);

$context = stream_context_create($opts);

$result = file_get_contents('http://example.com/submit.php', false, $context);

Options:

A.

A GET request will be performed on http://example.com/submit.php

B.

A POST request will be performed on http://example.com/submit.php

C.

An error will be displayed

Buy Now
Questions 29

What is the output of this code?

$world = 'world';

echo <<<'TEXT'

hello $world

TEXT;

Options:

A.

hello world

B.

hello $world

C.

PHP Parser error

Buy Now
Questions 30

What parsing methodology is utilized by the SimpleXML extension?

Options:

A.

SAX

B.

DOM

C.

XPath

D.

Push/Pull Approach

E.

Expat

Buy Now
Questions 31

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

Options:

A.

2XX

B.

3XX

C.

4XX

D.

5XX

Buy Now
Questions 32

Consider the following two files. When you run test.php, what would the output look like?

test.php:

include "MyString.php";

print ",";

print strlen("Hello world!");

MyString.php:

namespace MyFramework\String;

function strlen($str)

{

return \strlen($str)*2; // return double the string length

}

print strlen("Hello world!")

Options:

A.

12,12

B.

12,24

C.

24,12

D.

24,24

E.

PHP Fatal error: Cannot redeclare strlen()

Buy Now
Questions 33

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

Options:

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

Buy Now
Exam Code: 200-550
Exam Name: Zend Certified PHP Engineer
Last Update: May 16, 2024
Questions: 223
200-550 pdf

200-550 PDF

$28  $80
200-550 Engine

200-550 Testing Engine

$33.25  $95
200-550 PDF + Engine

200-550 PDF + Testing Engine

$45.5  $130