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

Zend 200-530 Zend PHP 5.3 Certification Exam Practice Test

Demo: 38 questions
Total 254 questions

Zend PHP 5.3 Certification Questions and Answers

Question 1

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,

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

Is the following code piece E_STRICT compliant?

final class Testing {

private $test;

public function tester() {

return "Tested!";

}}

Options:

A.

Yes

B.

No

Question 4

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

Question 5

Which of the listed changes would you make to the following PHP 4 code in order to make it most compliant with PHP 5? (Choose 2)

class Car {

var $model;

function Car($model) {

$this->model = $model;

} function toString() {

return "I drive a $this->model.";

}}

$c = new Car('Dodge');

echo $c->toString();

?>

Options:

A.

Change var to public or private

B.

Change function Car to function_construct

C.

Change "I drive a $this->model." to "I drive a {$this->model}."

D.

Change function toString()to static function toString()

Question 6

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 7

Assuming UTF-8 encoding, what is the value of $count?

Options:

A.

false

B.

4

C.

6

D.

7

Question 8

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 9

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

Question 10

What will the following code print?

echo addslashes('I am a small "HTML" string, which is

\'invalid\'.');

Options:

A.

I am a small "HTML" string, which is 'invalid'.

B.

I am a small \"HTML\" string, which is \'invalid\'.

C.

I am a small \"HTML\" string, which is \\'invalid\\'.

D.

I am a small \"HTML\" string, which is \\\'invalid\\\'.

E.

I am a \small\<\/b\> "HTML" string, which is 'invalid'\<\/u\>.

Question 11

When checking whether two English words are pronounced alike, which function should be used for the best possible result?

Options:

A.

levenshtein()

B.

metaphone()

C.

similar_text()

D.

soundex()

Question 12

Which DOMElement property provides a reference to the list of Element's children?

Options:

Question 13

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

Question 14

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.

Question 15

Which of the following statements is true?

Options:

A.

All PHP database extensions support prepared statements

B.

All PHP database extensions come with their own special helper functions to escape user data to be used in dynamic SQL queries

C.

All PHP database extensions provide an OOP interface

D.

All PHP database extensions appear in the output of php -m , if installed

Question 16

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 property 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");

Question 17

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 18

Which of the following statements about PHP is true? (Choose 3)

Options:

A.

A final class can be derived.

B.

A final class may be instantiated.

C.

A class with a final function may be derived.

D.

Static functions can be final.

E.

Properties can be final.

Question 19

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

Question 20

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 21

What is the output of the following script?

1

2 class a

3 {

4 public $val = 10;

5 }

6

7 function renderVal (a $a)

8 {

9 return $a->$val;

10 }

11

12 renderVal (new a);

13 ?>

Options:

A.

Nothing

B.

NULL

C.

A fatal error

D.

$val

E.

10

Question 22

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 23

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 24

Which PHP function sets a cookie whose value does not get URL encoded when sending it to the browser?

Options:

Question 25

Given a JSON-encoded string, which code sample correctly indicates how to decode the string to native PHP values?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 26

Which piece of code will return the ASCII value of a character?

Options:

A.

(int)'t';

B.

ord('t');

C.

to_ascii('t');

D.

chr('t');

Question 27

Consider the following code. What can be said about the call to file_get_contents?

Options:

A.

A GET request will be performed on http://example.com/submit.php

B.

A POST request will be performed on http://example com/submit.php

C.

An error will be displayed

Question 28

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 29

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 30

What is "instanceof" an example of:

Options:

A.

a boolean

B.

an operator

C.

a function

D.

a language construct

E.

a class magic

Question 31

Which of the following XML declarations is NOT valid?

Options:

A.

B.

C.

D.

Question 32

What is the output of the following code?

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 33

A/hen comparing prepared statements and regular, application-constructed SQL statements, which of the following is true?

Options:

A.

Prepared statements are faster

B.

Prepared statements are always shorter

C.

Prepared statements are more secure

D.

Prepared statements are easier to develop

E.

None of the above

Question 34

The function mysqli_affected_rows() can be used to perform which of the following actions? (Choose 2)

Options:

A.

get the number of rows that are affected by SELECT statements

B.

get the number of rows that are affected by UPDATE statements

C.

get the number of rows that are affected by INSERT statements

D.

get the number of rows in a result set

E.

get the numbers of rows that are affected after committing a transaction using COMMIT

Question 35

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

Question 36

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)

Question 37

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

Options:

A.

Class

B.

Abstract

C.

Interface

D.

Final

Question 38

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

Options:

A.

It is possible to specify more than one __autoload function

B.

__autoload receives the missing class name all lowercased

C.

__autoload is being called for missing interfaces

D.

Inside __autoload missing classes trigger __autoload

Demo: 38 questions
Total 254 questions