New Year Special Sale - 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: spcl70

Practice Free 200-500 Zend PHP 5 Certification Exam Questions Answers With Explanation

We at Crack4sure are committed to giving students who are preparing for the Zend 200-500 Exam the most current and reliable questions . To help people study, we've made some of our Zend PHP 5 Certification exam materials available for free to everyone. You can take the Free 200-500 Practice Test as many times as you want. The answers to the practice questions are given, and each answer is explained.

Question # 6

What is the output of the following code?

printf('%4$d %2$s sit on 2 trees and eat %3$3.2f %1$s', "bananas",

"monkeys", 9, 99);

A.

%4$d %2$s sit on 2 trees and eat %3$3.2f %1$s

B.

99 monkeys sit on 2 trees and eat 9.00 bananas

C.

Monkeys Bananas sit on 2 trees and eat 9 99

D.

9 monkeys sit on 2 trees and eat 99 bananas

Question # 7

Which of the following are valid identifiers (Choose 3)

A.

function 4You() { }

B.

function _4You() { }

C.

function object() { }

D.

$1 = "Hello";

E.

$_1 = "Hello World";

Question # 8

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

A.

ob_start()

B.

set_write_buffer()

C.

stream_set_write_buffer()

D.

Change the output_buffering INI setting via ini_set() function

Question # 9

Which of the following commands will append data to an existing file?

A.

file_put_contents("file", "data", "a");

B.

file_put_contents("file", "a", "data");

C.

file_put_contents("file", "data", FILE_APPEND);

D.

file_put_contents("file", "a", NULL, FILE_APPEND);

Question # 10

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

A.

$_GET['ALL']

B.

$_SERVER['QUERY']

C.

$_SERVER['QUERY_STRING']

D.

$_ENV['QUERY']

E.

$QUERY_STRING

Question # 11

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

A.

magic_quotes_gpc()

B.

strip_tags()

C.

addslashes()

D.

session_regenerate_id()

Question # 12

Which of the following is an invalid DOM save method?

A.

save()

B.

saveFile()

C.

saveXML()

D.

saveHTML()

E.

saveHTMLFile()

Question # 13

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

A.

dirname()

realpath()

B.

basename()

C.

pathinfo()

D.

parse_url()

Question # 14

What parsing methodology is utilized by the SimpleXML extension?

A.

SAX

B.

DOM

C.

XPath

D.

Push/Pull Approach

E.

Expat

Question # 15

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

}

A.

Both functions do the same

B.

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

Question # 16

What is the purpose of the 4th argument to the file_get_contents() function?

A.

Indicate the number of bytes to read

B.

Specifies the stream context

C.

Indicates whether or not include_path should be used

D.

Identifies the starting offset

E.

None of the above

Question # 17

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

A.

$_SERVER

B.

$_ENV

C.

$GLOBALS

D.

$_POST

E.

$_ARGV

Question # 18

What is the method used to execute XPath queries in the SimpleXML extension?

A.

xpathQuery()

B.

xpath()

C.

simpleXMLXpath()

D.

query()

E.

evaluate()

Question # 19

PHP's array functions such as array_values() and array_key_exists() can be used on an object if the object...

A.

implements Traversable

B.

is an instance of ArrayObject

C.

implements ArrayAccess

D.

None of the above

Question # 20

The purpose of the singleton pattern is to...

A.

...create applications that only a single user may use.

B.

...have just one single instance of an object in the entire application.

C.

...have only one instance of each object in a collection of objects.

Question # 21

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

accessed?

Value

A.

$xml->bar['foo']

B.

$xml->bar->foo

C.

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

D.

$xml->document->bar->foo

E.

$xml->getElementByName('foo');

Question # 22

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

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 # 23

What will the $array array contain at the end of this script?

1

2 function modifyArray (&$array)

3 {

4 foreach ($array as &$value)

5 {

6 $value = $value + 1;

7 }

8

9 $value = $value + 2;

10 }

11

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

13 modifyArray($array);

14 ?>

A.

2, 3, 4

B.

2, 3, 6

C.

4, 5, 6

D.

1, 2, 3

Question # 24

What does the chown() function do?

A.

Change the file permissions.

B.

Change the owner of the file.

C.

Change the group of the file.

D.

Checks if the file is accessible.

Question # 25

Where does the session extension store the session data by default?

A.

SQLite Database

B.

MySQL Database

C.

Shared Memory

D.

File system

E.

Session Server

Question # 26

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

A.

__call()

B.

__get()

C.

__set()

D.

__wakeup()

E.

__fetch()

Question # 27

What XML component does the following XPath query try to match?

//foo[bar/@id=5]

A.

bar element with an id attribute whose value is equal to 5

B.

foo element containing a child node bar tag

C.

id attribute whose value is equal to 5

D.

foo element with a child note bar whose id attribute is equal to 5

E.

all of the foo elements that have a child node bar, whose id attribute is equal to 5

Question # 28

What is the output of the following code:

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

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

Question # 29

Which of the following will set a 10 seconds read timeout for a stream?

A.

ini_set("default_socket_timeout", 10);

B.

stream_read_timeout($stream, 10);

C.

Specify the timeout as the 5th parameter to the fsockopen() function used to open a stream

D.

stream_set_timeout($stream, 10);

E.

None of the above

Question # 30

An HTML form contains this form element:

The user clicks on the image to submit the form. How can you now access the relative coordinates of the mouse click?

A.

$_IMAGE['myImage']['x'] and $_IMAGE['myImage']['y']

B.

$_POST['myImage']['x'] and $_POST['myImage']['x']

C.

$_POST['myImage.x'] and $_POST['myImage.y']

D.

$_POST['myImage_x'] and $_POST['myImage_y']

Question # 31

Which of the following statements is NOT true?

a) Class constants are public

b) Class constants are being inherited

c) Class constants can omit initialization (default to NULL)

d) Class constants can be initialized by consts

A.

a)

B.

b)

C.

c)

D.

d)

Question # 32

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?

A.

Adapter

B.

Factory

C.

MVC

D.

Singleton

Question # 33

Which of the following data types cannot be directly manipulated by the client?

A.

Cookie Data

B.

Session Data

C.

Remote IP Address

D.

User Agent

Question # 34

Which of the following statements is correct?

A.

Interfaces can extend only one interface

B.

Interfaces can extend more than one interface

C.

Interfaces can inherit a method from different interfaces

D.

Interfaces can redeclare inherited methods

Question # 35

Given the following code, what is correct?

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

}

$z = new stdClass;

f($z);

var_dump($z);

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

Question # 36

What is the return value of the following code?

strpos("me myself and I", "m", 2)

A.

2

B.

3

C.

4

D.

0

E.

1

Question # 37

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

A.

$_SERVER

B.

$_ENV

C.

$_POST

D.

$_FILES

E.

$_GET

Question # 38

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']?

A.

accept

B.

ok

C.

true

D.

on

Question # 39

What is the content of $c after the following code has executed?

$a = 2;

$b = 3;

$c = ($a++ * ++$b);

A.

0

B.

5

C.

8

D.

4

Question # 40

Webservices are primarily meant to support

A.

business-to-business communication

B.

machine-to-machine interaction

C.

improved accessibility for websites

Question # 41

What is the error in the following declaration of a static class method?

1

2 class car {

3 static $speeds = array(

4 'fast',

5 'slow',

6 'medium',

7 );

8

9 static function getSpeeds()

10 {

11 return $this->speeds;

12 }

13 }

14 ?>

A.

Static methods must not return a value.

B.

The use of $this from within static methods is not possible.

C.

Static methods need the method keyword instead of the function keyword.

D.

There is no static keyword in PHP.

Question # 42

How many elements does the $matches array contain after the following function call is performed?

preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=200[0-9])/', '21st March

2006', $matches);

A.

1

B.

2

C.

3

D.

4

Question # 43

Identify the security vulnerability in the following example:

1

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

3 ?>

A.

SQL Injection

B.

Cross-Site Scripting

C.

Remote Code Injection

D.

None of the above

Question # 44

Given the following code, what will be the value of $a?

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

array_push($a, array(1, 2));

A.

array('a', 'b', 1, 2)

B.

array(1, 2, 'a', 'b')

C.

array(array(1, 2), 'a', 'b')

D.

None of the above

Question # 45

What is the output of the following script?

1

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 ?>

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,

Question # 46

What is "instanceof" an example of:

A.

a boolean

B.

an operator

C.

a function

D.

a language construct

E.

a class magic

Question # 47

Which of the following configuration directives increase the risk of remote code injection when enabled? (Choose 2)

A.

allow_url_fopen

B.

register_globals

C.

magic_quotes_gpc

D.

safe_mode

Question # 48

What is the output of the following code?

echo "22" + "0.2", 23 . 1;

A.

220.2231

B.

22.2231

C.

22.2,231

D.

56.2

Question # 49

Which of the following is correct? (Choose 2)

1) A class can extend more than one class.

2) A class can implement more than one class.

3) A class can extend more than one interface.

4) A class can implement more than one interface.

5) An interface can extend more than one interface.

6) An interface can implement more than one interface.

A.

1)

B.

2)

C.

3)

D.

4)

E.

5)

F.

6)

Question # 50

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

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 # 51

When you need to process the values of columns in a database, you should:

A.

Only use built-in database functions

B.

Always use read the values as-is from the database and then process them with PHP

C.

Use built-in database functions for simple processing, and perform more complicated logic in PHP

D.

Use built-in database functions for complicated logic, and perform simpler functions in PHP

Question # 52

Which methods can be used to overload object properties? (Choose 2)

A.

set(), get()

B.

__set(), __get()

C.

__put(), __receive(), __exists()

D.

set(), get(), isset()

E.

__isset(), __unset()

Question # 53

Which parts of the text are matched in the following regular expression?

1

2 $text = <<

3 The big bang bonged under the bung.

4 EOT;

5

6 preg_match_all('@b.n?g@', $text, $matches);

7 ?>

A.

bang bong bung

B.

bang bonged bung

C.

big bang bong bung

D.

big bang bung

Question # 54

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

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 # 55

Which of these protocols are NOT governed by the W3C in their latest versions? (Choose 2)

A.

XML-RPC

B.

SOAP

C.

WSDL

D.

UDDI

Question # 56

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

A.

getElementById()

B.

getElementsByTagName()

C.

getElementsByTagNameNS()

D.

getElementByName()

E.

findTag()

Question # 57

You are creating an application that repeatedly connects to a database to retrieve order data for invoices. All data comes from the same database. In order to preserve resources, you have to ensure that only one database connection should be used at any time. The code also has to open as few new database connections as possible. Which design pattern should you use for this scenario?

A.

Adapter

B.

Factory

C.

MVC

D.

Singleton

Question # 58

Which is the most efficient way to determine if a key is present in an array,assuming the array has no NULL values?

A.

in_array('key', array_keys($a))

B.

isset($a['key'])

C.

array_key_exists('key', $a)

D.

None of the above

Question # 59

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

A.

implements

B.

instanceof

C.

static

D.

abstract

Question # 60

Which of the following techniques ensures that a value submitted in a form can only be yes or no?

A.

Use a select list that only lets the user choose between yes and no.

B.

Use a hidden input field that has a value of yes or no.

C.

Enable the safe_mode configuration directive.

D.

None of the above.

Question # 61

Is the following code piece E_STRICT compliant?

final class Testing {

var $test = 0;

public function tester() {

return "Tested!";

}}

A.

Yes

B.

No

Question # 62

How can the constant defined below be accessed from within PHP?

class myClass {

const FOO = 'BAR';

}

A.

myClass::$FOO

B.

myClass::$$FOO

C.

myClass::FOO

D.

myClass::foo

E.

$foo::myClass

Question # 63

Is the following code piece E_STRICT compliant?

final class Testing {

private $test;

public function tester() {

return "Tested!";

}}

A.

Yes

B.

No

Question # 64

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

A.

Add indices on joined columns

B.

Add a WHERE clause

C.

Add a LIMIT clause

D.

Use an inner join

Question # 65

You need to escape special characters to use user input inside a regular expression. Which functions would you use? (Choose 2)

A.

addslashes()

B.

htmlentities()

C.

preg_quote()

D.

regex_quote()

E.

quotemeta()

200-500 PDF

$33

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

200-500 PDF + Testing Engine

$52.8

$175.99

3 Months Free Update

  • Exam Name: Zend PHP 5 Certification
  • Last Update: Dec 14, 2025
  • Questions and Answers: 219
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

200-500 Engine

$39.6

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included