Labour Day Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

Zend 200-500 Zend PHP 5 Certification Exam Practice Test

Demo: 32 questions
Total 219 questions

Zend PHP 5 Certification Questions and Answers

Question 1

What PHP function can be used to remove a local file?

Options:

A.

A) rmdir()

B.

B) unlink()

C.

C) rm()

D.

D) delete()

E.

E) delete_file()

Question 2

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 3

How can you determine if magic_quotes_gpc is enabled? (Choose 2)

Options:

A.

Use the get_magic_quotes() function.

B.

Using the get_magic_quotes_runtime() function.

C.

Use the get_magic_quotes_gpc() function.

D.

Using ini_get('magic_quotes_gpc').

E.

Using ini_get('magic_quotes').

Question 4

Which of the following is NOT a valid function declaration?

Options:

A.

function x ($x1 = array())

B.

function x (A $x1)

C.

function x (A $x1 = null)

D.

function x ($x1 = $x2)

Question 5

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 6

Transactions are used to:

Options:

A.

guarantee high performance

B.

secure data consistency

C.

secure access to the database

D.

reduce the database server overhead

E.

reduce code size in PHP

Question 7

What is the output of the following script?

1

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

Question 8

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 9

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 10

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

Options:

A.

implements Traversable

B.

is an instance of ArrayObject

C.

implements ArrayAccess

D.

None of the above

Question 11

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

//foo[bar/@id=5]

Options:

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 12

What will be the output of the following code?

$a = array(0, 1, 2 => array(3, 4));

$a[3] = array(4, 5);

echo count($a, 1);

Options:

A.

4

B.

5

C.

8

D.

None of the above

Question 13

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

Question 14

In the following code, which class can be instantiated?

1

2 abstract class Graphics {

3 abstract function draw($im, $col);

4 }

5

6 abstract class Point1 extends Graphics {

7 public $x, $y;

8 function __construct($x, $y) {

9 $this->x = $x;

10 $this->y = $y;

11 }

12 function draw($im, $col) {

13 ImageSetPixel($im, $this->x, $this->y, $col);

14 }

15 }

16

17 class Point2 extends Point1 { }

18

19 abstract class Point3 extends Point2 { }

20 ?>

Options:

A.

Graphics

B.

Point1

C.

Point2

D.

Point3

E.

None, the code is invalid

Question 15

What is the output of the following code?

str_pad('PHP', 10, 'P', STR_PAD_BOTH);

Options:

A.

H

B.

PHPPPPPPPP

C.

PPPPHPPPPP

D.

PPPPPPPPHP

Question 16

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

Options:

A.

SQLite Database

B.

MySQL Database

C.

Shared Memory

D.

File system

E.

Session Server

Question 17

Would the following code catch a parse error?

try {

echo $label

} catch (Exception $e) {

echo $e->getMessage();

}

Options:

A.

Yes

B.

No

Question 18

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

Question 19

You analyze the code of a collegue and see, it uses the function strcasecmp. You try it out to see what it does and use the following function call:

strcasecmp('hello my dear!', 'Hello my DEAR!');

The function call returns "0". What does that mean?

Options:

A.

String 1 is less than string 2.

B.

The strings are considered equal.

C.

String 2 is less than string 1.

D.

The strings have equal length.

Question 20

What is the function of backtick (`) characters in PHP?

Options:

A.

Same as single-quotes, used to enclose strings.

B.

Escape operators.

C.

No special meaning.

D.

Execute the enclosed string as a command.

E.

Error control operators.

Question 21

What is the output of the following code?

class test {

public $value = 0;

function test() {

$this->value = 1;

} function __construct() {

$this->value = 2;

}}

$object = new test();

echo $object->value;

Options:

A.

2

B.

1

C.

0

D.

3

E.

No Output, PHP will generate an error message.

Question 22

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 23

Webservices are primarily meant to support

Options:

A.

business-to-business communication

B.

machine-to-machine interaction

C.

improved accessibility for websites

Question 24

A script residing at http://example.com/phpcert/cookies.php contains the following code:

1

2 setcookie('name1', 'value1', time() + 60*60*24, '/');

3 setcookie('name1', 'value2');

4 ?>

The web browser is configured to accept all cookies. How many cookies will be set by this script?

Options:

A.

0

B.

1

C.

2

D.

3

Question 25

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.

Question 26

How can precisely one byte be read from a file, pointed by $fp? (Choose 2)

Options:

A.

fread($fp, 1);

B.

fgets($fp, 1);

C.

fgetss($fp, 1);

D.

fgetc($fp);

E.

All of the above

Question 27

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?

Options:

A.

Adapter

B.

Factory

C.

MVC

D.

Singleton

Question 28

Which 2.17of the following formats is used to describe web services?

Options:

A.

WSDL

B.

UDDI

C.

SOAP

D.

XLANG

Question 29

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

Options:

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 30

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

Options:

A.

XSL

B.

SOAP

C.

DOM

D.

SAX

Question 31

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

Options:

A.

XML-RPC

B.

SOAP

C.

WSDL

D.

UDDI

Question 32

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

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,

Demo: 32 questions
Total 219 questions