Winter Special Flat 65% Limited Time Discount offer - Ends in 0d 00h 00m 00s - Coupon code: netdisc

Zend 200-500 Zend PHP 5 Certification Exam Practice Test

Page: 1 / 22
Total 219 questions

Zend PHP 5 Certification Questions and Answers

Testing Engine

  • Product Type: Testing Engine
$42  $119.99

PDF Study Guide

  • Product Type: PDF Study Guide
$36.75  $104.99
Question 1

What is the difference between "print" and "echo"

Options:

A.

There is no difference

B.

Print returns length of data printed and echo does not

C.

Echo returns length of the data printed and print does not

D.

Print buffers the output, while echo does not

Question 2

Which of the following XML declarations is NOT valid?

Options:

A.

B.

C.

D.

Question 3

What visibility denies access to properties and methods outside of the class?

Options:

A.

static

B.

protected

C.

private

D.

public

E.

const

Question 4

What object method specifies post-serialization behavior for an object?

Options:

A.

__sleep()

B.

__wakeup()

C.

__set_state()

D.

__get()

E.

__autoload()

Question 5

What method can be used to find a tag with the name "foo" via the DOM extension?

Options:

A.

getElementById()

B.

getElementsByTagName()

C.

getElementsByTagNameNS()

D.

getElementByName()

E.

findTag()

Question 6

What is the output of the following code?

$a = 1;

++$a;

$a*=$a;

echo $a--;

Options:

A.

4

B.

3

C.

5

D.

0

E.

1

Question 7

Which one of the following technologies was not built into PHP before version 5?

Options:

A.

XSL

B.

SOAP

C.

DOM

D.

SAX

Question 8

How can you redirect a client to another page using PHP?

Options:

A.

header('Location: /another_page.php');

B.

header('Content-Location: /another_page.php');

C.

header('Redirect: /another_page.php');

D.

header('Redirect: /another_page.php', 1, 302);

E.

header('HTTP/1.1 302 /another_page.php');

Question 9

What is the result of the following bitwise operation in PHP?

1 ^ 2

Options:

A.

1

B.

3

C.

2

D.

4

Question 10

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.

Question 11

What is the output of the following script?

1

2 class a

3 {

4 public $val;

5 }

6

7 function renderVal (a $a)

8 {

9 if ($a) {

10 echo $a->val;

11 }

12 }

13

14 renderVal (null);

15 ?>

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

Question 12

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

Options:

A.

getAttributeNS()

B.

getAttribute()

C.

hasAttribute()

D.

hasAttributeNS()

Question 13

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.

Is no longer iteratable.

Question 14

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

Question 15

What super-global should be used to access information about uploaded files via a POST request?

Options:

A.

$_SERVER

B.

$_ENV

C.

$_POST

D.

$_FILES

E.

$_GET

Question 16

Would the following code catch a parse error?

try {

echo $label

} catch (Exception $e) {

echo $e->getMessage();

}

Options:

A.

Yes

B.

No

Question 17

Can a private static member be accessed from a public static method of the same class?

Options:

A.

Yes

B.

No

C.

Only if the class is defined as an abstract

Question 18

Which of the following statements about Reflection are correct? (Choose 2)

Options:

A.

Since 5.1 reflection is an extension that can be disabled

B.

Reflection is present in any installation of PHP 5 or later

C.

Reflection only allows to reflect on built-in classes

D.

Built-in classes can be reflected on command line using php –rc

Question 19

What function allows resizing of PHP's file write buffer?

Options:

A.

ob_start()

B.

set_write_buffer()

C.

stream_set_write_buffer()

D.

Change the output_buffering INI setting via ini_set() function

Question 20

Which PHP function retrieves a list of HTTP headers that have been sent as part of the HTTP response or are ready to be sent?

Options:

A.

header()

B.

headers()

C.

headers_list()

D.

headers_sent()

Question 21

When PHP is running on a command line, what super-global will contain the command line arguments specified?

Options:

A.

$_SERVER

B.

$_ENV

C.

$GLOBALS

D.

$_POST

E.

$_ARGV

Question 22

Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?

Options:

A.

$_GET['ALL']

B.

$_SERVER['QUERY']

C.

$_SERVER['QUERY_STRING']

D.

$_ENV['QUERY']

E.

$QUERY_STRING

Question 23

Given the following two functions, what statement is correct?

function dynamicNew($name) {

return new $name;

}

function reflectionNew($name) {

$r = new ReflectionClass($name);

return $r->newInstanceArgs();

}

Options:

A.

Both functions do the same

B.

dynamicNew() results in a parse error, reflectionNew() works

Question 24

What function returns the filename component of the file's path:

Options:

A.

dirname()

realpath()

B.

basename()

C.

pathinfo()

D.

parse_url()

Question 25

Consider the following XML code:

<books>

<book id="1">PHP 5 Power Programming

<book id="2">Learning PHP 5

Which of the following SimpleXML calls print the name of the second book?

(Let $xml=simplexml_load_file("books.xml");) (Choose 2)

Options:

A.

echo $xml->books->book[2];

B.

echo $xml->books->book[1];

C.

echo $xml->book[1];

D.

echo $xml->xpath("/books/book[@id=2]");

E.

$c = $xml->children(); echo $c[1];

Question 26

How can a PHP extension be loaded? (Choose 2)

Options:

A.

ini_set("extension", "extension.so");

B.

dl("extension.so");

C.

extension_load("extension.so");

D.

extension=extension.so inside php.ini

Question 27

Which of the following statements about database connections are commonly true? (Choose 2)

Options:

A.

Database connections are closed after each SQL statement is executed

B.

Database connections are closed at the end of each request

C.

Database connections are only closed when the Web server shuts down

D.

A single database connection may serve more than one PHP application at the same time

Question 28

Identify the security vulnerability in the following example:

1

2 mail('feedback@example.org',

3 'Feddback',

4 'Here is my feedback.',

5 "From: {$_COOKIE['email']}");

6 ?>

Options:

A.

Remote Code Injection

B.

Cross-Site Request Forgeries

C.

Email Injection

D.

None of the above

Question 29

The following code piece should print "PHP is cool", but unexpectedly, it just prints "cool". How would you correct it?

echo str_replace('PHP is a pain.', 'a pain', 'cool');

Options:

A.

str_replace('PHP is a pain.', 'cool', 'a pain');

B.

str_replace('a pain', 'cool', 'PHP is a pain.');

C.

str_replace('cool', 'a pain', 'PHP is a pain.');

Question 30

Which of the following rules must every correct XML document adhere to? (Choose 2)

Options:

A.

It has to be well-formed.

B.

It has to be valid.

C.

It has to be associated to a DTD.

D.

It may only contain UTF-8 encoded characters.

Question 31

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

Question 32

Which technique should be used to speed up joins without changing their results?

Options:

A.

Add indices on joined columns

B.

Add a WHERE clause

C.

Add a LIMIT clause

D.

Use an inner join

Page: 1 / 22
Total 219 questions