Spring Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: pass65

200-500 Zend PHP 5 Certification Questions and Answers

Questions 4

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

Options:

A.

static

B.

protected

C.

private

D.

public

E.

const

Buy Now
Questions 5

What is the output of the following code: echo " 1 " + 2 * " 0x02 " ;

Options:

A.

1

B.

3

C.

5

D.

20

E.

7

Buy Now
Questions 6

Which of the following keywords is not new in PHP 5?

Options:

A.

implements

B.

instanceof

C.

static

D.

abstract

Buy Now
Questions 7

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

Buy Now
Questions 8

In the function setcookie() what does the 3rd parameter specify?

Options:

A.

The name of the cookie.

B.

The expiration time of the cookie.

C.

The value of the cookie.

D.

The IP address of the cookie ' s client.

Buy Now
Questions 9

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

Buy Now
Questions 10

Some databases support the LIMIT clause. It is a method to ensure that ...

Options:

A.

only certain rows are deleted in DELETE queries.

B.

only a defined subset of rows are read in SELECT queries.

C.

only certain users can access the database.

Buy Now
Questions 11

How many elements does the array $pieces contain after the following piece of code has been executed?

$pieces = explode( " / " , " /// " );

Options:

A.

0

B.

3

C.

4

D.

5

Buy Now
Questions 12

Which of the following are valid SoapClient calls? (Choose 2)

Options:

A.

$client = new SoapClient( " weather.wsdl " );

B.

$client = new SoapClient;

C.

$client = new SoapClient(null, array( " location " = >

" http://example.com/weather " , " uri " = > " http://test-uri.com/ " ));

D.

$client = new SoapClient(null, array());

Buy Now
Questions 13

What does the __FILE__ constant contain?

Options:

A.

The filename of the current script.

B.

The full path to the current script.

C.

The URL of the request made.

D.

The path to the main script.

Buy Now
Questions 14

Which of the following functions can help prevent session fixation vulnerabilities?

Options:

A.

magic_quotes_gpc()

B.

strip_tags()

C.

addslashes()

D.

session_regenerate_id()

Buy Now
Questions 15

What DOM method is used to load HTML files?

Options:

A.

load()

B.

loadXML()

C.

loadHTML()

D.

loadHTMLFile()

Buy Now
Questions 16

Which of the following function signatures is correct if you want to have classes automatically loaded?

Options:

A.

function autoload($class_name)

B.

function __autoload($class_name, $file)

C.

function __autoload($class_name)

D.

function _autoload($class_name)

E.

function autoload($class_name, $file)

Buy Now
Questions 17

Which of the following parts must a XML document have in order to be well-formed?

Options:

A.

An XML declaration

B.

A root element

C.

A specified encoding

D.

A reference to either a DTD or an XML schema definition

Buy Now
Questions 18

What is the output of the following code:

str_replace(array( " Apple " , " Orange " ), array( " Orange " , " Apple " ), " Oranges are orange and Apples are green " );

Options:

A.

Apples are orange and Oranges are green

B.

Apples are orange and Apples are green

C.

Apples are apple and Oranges are green

D.

Apples are apple and Apples are green

Buy Now
Questions 19

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

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

}

Options:

A.

a)

B.

b)

C.

c)

D.

d)

Buy Now
Questions 20

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

Buy Now
Questions 21

Which function can help prevent cross-site scripting? (Choose 2)

Options:

A.

addslashes()

B.

htmlentities()

C.

htmlspecialchars()

D.

strip_tags()

E.

quotemeta()

Buy Now
Questions 22

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

Buy Now
Questions 23

What is the output of the following script?

1 < ?php

2 function ratio ($x1 = 10, $x2)

3 {

4 if (isset ($x2)) {

5 return $x2 / $x1;

6 }

7 }

8

9 echo ratio (0);

10 ? >

Options:

A.

0

B.

An integer overflow error

C.

A warning, because $x1 is not set

D.

A warning, because $x2 is not set

E.

A floating-point overflow error

Buy Now
Questions 24

What can prevent PHP from being able to open a file on the hard drive (Choose 3)?

Options:

A.

File system permissions

B.

File is outside of open_basedir

C.

File is owned by another user and safe_mode is enabled.

D.

File is inside the /tmp directory.

E.

PHP is running as the web server user.

Buy Now
Questions 25

How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object found inside $xml?

< ?xml version= ' 1.0 ' ? >

< foo >

< bar >

< baz id= " 1 " > One < /baz >

< baz id= " 2 " > Two < /baz >

< /bar >

< /foo >

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 26

The XML document below has been parsed into $xml via SimpleXML. How can the value of < foo > tag

accessed?

< ?xml version= ' 1.0 ' ? >

< document >

< bar >

< foo > Value < /foo >

< /bar >

< /document >

Options:

A.

$xml- > bar[ ' foo ' ]

B.

$xml- > bar- > foo

C.

$xml[ ' document ' ][ ' bar ' ][ ' foo ' ]

D.

$xml- > document- > bar- > foo

E.

$xml- > getElementByName( ' foo ' );

Buy Now
Questions 27

Given the following array:

$a = array(28, 15, 77, 43);

Which function will remove the value 28 from $a?

Options:

A.

array_shift()

B.

array_pop()

C.

array_pull()

D.

array_unshift()

Buy Now
Questions 28

What type of class definition can be used to define multiple inheritance?

Options:

A.

Class

B.

Abstract

C.

Interface

D.

Final

Buy Now
Questions 29

When a transaction reports no affected rows, it means that: (Choose 2)

Options:

A.

The transaction failed

B.

The transaction affected no lines

C.

The transaction was rolled back

D.

The transaction was committed without error

Buy Now
Questions 30

What is the output of the following code?

try {

class MyException extends Exception {};

try {

throw new MyException;

}

catch (Exception $e) {

echo " 1: " ;

throw $e;

}c

atch (MyException $e) {

echo " 2: " ;

throw $e;

}}

catch (Exception $e) {

echo get_class($e);

}

Options:

A.

A parser error, try cannot be followd by multiple catch

B.

1:

C.

2:

D.

1:Exception

E.

1:MyException

F.

2:MyException

G.

MyException

Buy Now
Questions 31

What happens if you try to access a property whose name is defined in a parent class as private, and is not declared in the current class?

Options:

A.

An E_NOTICE error will be triggered.

B.

An E_ERROR error will be triggered.

C.

An E_WARNING error will be triggered.

D.

No errors will be triggered

Buy Now
Questions 32

You want to extract the pieces of a date string, which looks like this:

" 2005-11-02 " . Which of the following pieces of code will properly assign $year,

$month and $day with their respective values?

Options:

A.

sscanf( " 2005-11-02 " , ' %d-%d-%d ' , $year, $month, $day);

B.

scan( " 2005-11-02 " , ' %d-%d-%d ' , $year, $month, $day);

C.

sscanf( ' %d-%d-%d ' , " 2005-11-02 " , $year, $month, $day);

D.

sscan($year, $month, $date ' %d-%d-%d ' , " 2005-11-02 " );

Buy Now
Questions 33

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

Buy Now
Questions 34

Which of the following is an invalid DOM save method?

Options:

A.

save()

B.

saveFile()

C.

saveXML()

D.

saveHTML()

E.

saveHTMLFile()

Buy Now
Questions 35

How can a SimpleXML object be converted to a DOM object?

Options:

A.

dom_import_simplexml()

B.

dom_export_simplexml()

C.

simplexml_import_dom()

D.

SimpleXML2Dom()

E.

None of the above.

Buy Now
Questions 36

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

Options:

A.

dirname()

realpath()

B.

basename()

C.

pathinfo()

D.

parse_url()

Buy Now
Questions 37

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

Options:

A.

you can only throw classes derived from Exception

B.

a try block can have multiple catch blocks

C.

a try block must not be followed by a catch block

D.

try blocks cannot contain nested try blocks

Buy Now
Questions 38

After running this sort, what will be the value of $b?

$a = array( ' _! ' , ' def ' , 0);

$b = sort($a);

Options:

A.

array(0, ' def ' , ' _! ' )

B.

array( ' _! ' , 0, ' def ' )

C.

array( ' def ' , 0, ' _!)

D.

None of the above

Buy Now
Questions 39

What is the output of the following script?

1 < ?php

2 function fibonacci ( & $x1 = 0, & $x2 = 1)

3 {

4 $result = $x1 + $x2;

5 $x1 = $x2;

6 $x2 = $result;

7

8 return $result;

9 }

10

11 for ($i = 0; $i < 10; $i++) {

12 echo fibonacci() . ' , ' ;

13 }

14 ? >

Options:

A.

An error

B.

1,1,1,1,1,1,1,1,1,1,

C.

1,1,2,3,5,8,13,21,34,55,

D.

Nothing

Buy Now
Questions 40

Which of the following is NOT possible using reflection?

Options:

A.

Analysing of nearly any aspect of classes and interfaces

B.

Analysing of nearly any aspect of functions

C.

Adding class methods

D.

Implement dynamic construction (new with variable class name)

Buy Now
Questions 41

How many elements does the array $matches from the following code contain?

1 < ?php

2 $str = " The cat sat on the roof of their house. " ;

3

4 $matches = preg_split( " /(the)/i " , $str, -1,

PREG_SPLIT_DELIM_CAPTURE);

5 ? >

Options:

A.

2

B.

3

C.

4

D.

7

E.

9

Buy Now
Questions 42

What is the output of the following code?

1 < ?php

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

3 $a[$i] = $i;

4 }

5 echo count($a);

6 ? >

Options:

A.

0

B.

1

C.

2

D.

6

E.

7

Buy Now
Questions 43

After executing a SELECT query on a database server,

Options:

A.

All data is immediately transmitted to PHP

B.

All data will be transmitted on-demand to PHP

C.

None of the above

Buy Now
Questions 44

Which of the following statements is NOT correct?

Options:

A.

Only methods can have type hints

B.

Typehints can be optional

C.

Typehints can be references

Buy Now
Questions 45

What is the output of the following code?

1 < ?php

2 function append($str)

3 {

4 $str = $str. ' append ' ;

5 }

6

7 function prepend( & $str)

8 {

9 $str = ' prepend ' .$str;

10 }

11

12 $string = ' zce ' ;

13 append(prepend($string));

14 echo $string;

15 ? >

Options:

A.

zceappend

B.

prependzceappend

C.

prependzce

D.

zce

Buy Now
Questions 46

Can calls to Web Services be queued natively in PHP?

Options:

A.

Yes

B.

No

C.

Only if PHP is compiled with --enable-soap-queue

Buy Now
Questions 47

What is " instanceof " an example of:

Options:

A.

a boolean

B.

an operator

C.

a function

D.

a language construct

E.

a class magic

Buy Now
Questions 48

Which of the following superglobals does not contain data from the client?

Options:

A.

$_POST

B.

$_SESSION

C.

$_GET

D.

$_SERVER

Buy Now
Questions 49

What will be the value of $b after running the following code?

$a = array( ' c ' , ' b ' , ' a ' );

$b = (array)$a;

Options:

A.

TRUE

B.

array( ' c ' , ' b ' , ' a ' )

C.

array(array( ' c ' , ' b ' , ' a ' ))

D.

None of the above

Buy Now
Questions 50

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

Buy Now
Questions 51

What is the output of the following script?

1 < ?php

2 function fibonacci ($x1, $x2)

3 {

4 return $x1 + $x2;

5 }

6

7 $x1 = 0;

8 $x2 = 1;

9

10 for ($i = 0; $i < 10; $i++) {

11 echo fibonacci($x1, $x2) . ' , ' ;

12 }

13 ? >

Options:

A.

1,2,3,4,5,6,7,8,9

B.

1,2,3,4,5,6,7,8,9,10,

C.

1,2,3,5,8,13,21,34,55,89,

D.

1,1,1,1,1,1,1,1,1,1,

Buy Now
Questions 52

Which of the following can be registered as entry points with a SoapServer instance (choose 3)

Options:

A.

A single function

B.

A single method from a class

C.

Multiple functions at once

D.

All methods from a class

E.

All classes defined in a script

Buy Now
Questions 53

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 54

Identify the security vulnerability in the following example:

1 < ?php

2 echo " Welcome, {$_POST[ ' name ' ]}. " ;

3 ? >

Options:

A.

SQL Injection

B.

Cross-Site Scripting

C.

Remote Code Injection

D.

None of the above

Buy Now
Questions 55

You are creating an application that generates invoices in a variety of formats, including PDF, ODS and HTML. Each of these formats is represented as a PHP class in your application. While some of the operations can be performed on all of the different formats (such as saving and loading), other operations may be specific to one or two of the formats (such as setting as read only). Which design pattern should you use for this application?

Options:

A.

Adapter

B.

Factory

C.

MVC

D.

Singleton

Buy Now
Questions 56

What is the output of the following code?

$first = " second " ;

$second = " first " ;

echo $$$first;

Options:

A.

first

B.

second

C.

an empty string

D.

an error

Buy Now
Questions 57

Would the following code catch a parse error?

try {

echo $label

} catch (Exception $e) {

echo $e- > getMessage();

}

Options:

A.

Yes

B.

No

Buy Now
Questions 58

When working with the MVC paradigma, the business logic should be implemented in which of the following components?

Options:

A.

Model

B.

View

C.

Controller

Buy Now
Questions 59

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 60

You want to run the following PHP 4 code with PHP 5. In the following example, which access modifier in PHP 5 is equivalent to " var " ?

class Test {

var $tester;

}

Options:

A.

protected

B.

invisible

C.

public

D.

private

E.

outofscope

Buy Now
Questions 61

What function should be used to escape command line arguments that are passed to commands executed from PHP?

Options:

A.

addslashes()

B.

quotemeta()

C.

escapeshellarg()

D.

escapeshellcmd()

E.

passthru()

Buy Now
Questions 62

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

Buy Now
Questions 63

Given the following code, what is correct?

function f(stdClass & $x = NULL) { $x = 42;

}

$z = new stdClass;

f($z);

var_dump($z);

Options:

A.

Error: Typehints cannot be NULL

B.

Error: Typehints cannot be references

C.

Result is NULL

D.

Result is object of type stdClass

E.

Result is 42

Buy Now
Questions 64

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 65

Which of the following data types is implicitly passed by reference in PHP 5 while it is passed by value in PHP 4?

Options:

A.

Class

B.

String

C.

Object

D.

Array

Buy Now
Exam Code: 200-500
Exam Name: Zend PHP 5 Certification
Last Update: Apr 30, 2026
Questions: 219

PDF + Testing Engine

$63.52  $181.49

Testing Engine

$50.57  $144.49
buy now 200-500 testing engine

PDF (Q&A)

$43.57  $124.49
buy now 200-500 pdf