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

200-550 Zend Certified PHP Engineer Questions and Answers

Questions 4

What will be the output value of the following code?

$array = array(1,2,3);

while (list(,$v) = each($array));

var_dump(current($array));

Options:

A.

bool(false)

B.

int(3)

C.

int(1)

D.

NULL

E.

Array

Buy Now
Questions 5

Which of the following tasks can be achieved by using magic methods? (Choose 3)

Options:

A.

Initializing or uninitializing object data

B.

Creating a new stream wrapper

C.

Creating an iterable object

D.

Processing access to undefined methods or properties

E.

Overloading operators like +, *, etc.

F.

Converting objects to string representation

Buy Now
Questions 6

Which class of HTTP status codes is used for redirections?

Options:

A.

2XX

B.

3XX

C.

4XX

D.

5XX

Buy Now
Questions 7

What is the output of the following code?

for ($i = 0; $i < 1.02; $i += 0.17) {

$a[$i] = $i;

}

echo count($a);

Options:

A.

0

B.

1

C.

2

D.

6

E.

7

Buy Now
Questions 8

What is the output of the following code?

function increment ($val)

{

$_GET['m'] = (int) $_GET['m'] + 1;

}

$_GET['m'] = 1;

echo $_GET['m'];

Options:

Buy Now
Questions 9

Given the following code, what will the output be:

trait MyTrait {

private $abc = 1;

public function increment() {

$this->abc++;

}

public function getValue() {

return $this->abc;

}

}

class MyClass {

use MyTrait;

public function incrementBy2() {

$this->increment();

$this->abc++;

}

}

$c = new MyClass;

$c->incrementBy2();

var_dump($c->getValue());

Options:

A.

Fatal error: Access to private variable MyTrait::$abc from context MyClass

B.

Notice: Undefined property MyClass::$abc

C.

int(2)

D.

int(3)

E.

NULL

Buy Now
Questions 10

How many times will the function counter() be executed in the following code?

function counter($start, &$stop)

{

if ($stop > $start)

{

return;

}

counter($start--, ++$stop);

}

$start = 5;

$stop = 2;

counter($start, $stop);

Options:

A.

3

B.

4

C.

5

D.

6

Buy Now
Questions 11

How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class.

$obj = new MyObject();

array_walk($array, $obj);

Options:

A.

MyObject should extend class Closure

B.

MyObject should implement interface Callable

C.

MyObject should implement method __call

D.

MyObject should implement method __invoke

Buy Now
Questions 12

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 13

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 14

What will be the result of the following operation?

array_combine(array("A","B","C"), array(1,2,3));

Options:

A.

array("A","B","C",1,2,3)

B.

array(1,2,3,"A","B",C")

C.

array("A"=>1,"B"=>2,"C"=>3)

D.

array(1=>"A",2=>"B",3=>"C")

E.

array(1,2,3)

Buy Now
Questions 15

You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilites work? (Choose 2)

Options:

A.

echo $test(3);

B.

echo $test[2];

C.

echo $test(2);

D.

echo $test{2};

E.

echo $test{3};

Buy Now
Questions 16

Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP?

Options:

Buy Now
Questions 17

What DOM method is used to load HTML files?

Options:

A.

load()

B.

loadXML()

C.

loadHTML()

D.

loadHTMLFile()

Buy Now
Questions 18

What is the output of the following code?

$a = 'a'; $b = 'b';

echo isset($c) ? $a.$b.$c : ($c = 'c').'d';

Options:

A.

abc

B.

cd

C.

0d

Buy Now
Questions 19

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 20

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 21

Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?

Options:

A.

headers_sent() returns true

B.

Output buffering is enabled

C.

The client supports local buffering

D.

The webserver uses preemptive mode

Buy Now
Questions 22

Which of the following code snippets is correct? (Choose 2)

Options:

A.

interface Drawable {

abstract function draw();

}

B.

interface Point {

function getX();

function getY();

}

C.

interface Line extends Point {

function getX2();

function getY2();

}

D.

interface Circle implements Point {

function getRadius();

}

Buy Now
Questions 23

Which php.ini setting is usually required to use an opcode cache?

Options:

A.

extension

B.

zend_extension

C.

optimizer

D.

dl

Buy Now
Questions 24

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 25

What is the output of the following code?

var_dump(boolval([]));

Options:

A.

bool(true)

B.

bool(false)

Buy Now
Questions 26

When uploading a file to a PHP script using the HTTP PUT method, where would the file data be found?

Options:

A.

the $_FILES super-global

B.

the input stream php://input

C.

the $_POST super-global

D.

the global variable scope

Buy Now
Questions 27

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 28

What is the output of the following code?

echo 0x33, ' monkeys sit on ', 011, ' trees.';

Options:

A.

33 monkeys sit on 11 trees.

B.

51 monkeys sit on 9 trees.

C.

monkeys sit on trees.

D.

0x33 monkeys sit on 011 trees.

Buy Now
Questions 29

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

Options:

A.

2XX

B.

3XX

C.

4XX

D.

5XX

Buy Now
Questions 30

What function can reverse the order of values in an array so that keys are preserved?

Options:

A.

array_flip()

B.

array_reverse()

C.

rsort()

D.

krsort()

E.

array_multisort()

Buy Now
Questions 31

Before the headers are sent, how can you remove a previously set header?

Options:

A.

Use the header_remove() function, providing the name of the header

B.

Use the die() function to abort the PHP script

C.

Not possible

D.

Use the headers_list() function, providing the name of the header as the second argument

Buy Now
Questions 32

What is the output of the following code?

class a

{

public $val;

}

function renderVal (a $a)

{

if ($a) {

echo $a->val;

}

}

renderVal (null);

Options:

A.

A syntax error in the function declaration line

B.

An error, because null is not an instance of 'a'

C.

Nothing, because a null value is being passed to renderVal()

D.

NULL

Buy Now
Questions 33

Which value will be assigned to the key 0 in this example?

$foo = array(true, '0' => false, false => true);

Options:

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

PDF + Testing Engine

$130

Testing Engine

$95

PDF (Q&A)

$80