Independence Day Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: netdisc

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 purpose of the 4th argument to the file_get_contents() function?

Options:

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 2

Which of the following statements is correct?

Options:

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 3

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

Options:

A.

1

B.

3

C.

5

D.

20

E.

7

Question 4

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

1 ^ 2

Options:

A.

1

B.

3

C.

2

D.

4

Question 5

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 6

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

1

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

Question 7

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

accessed?

Value

Options:

A.

$xml->bar['foo']

B.

$xml->bar->foo

C.

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

D.

$xml->document->bar->foo

E.

$xml->getElementByName('foo');

Question 8

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 9

What piece of code would you use to obtain an array of response headers for a given URL, indexed by their respective names?

Options:

A.

get_headers($url);

B.

get_header($url);

C.

stream_context_get_headers($url);

D.

get_headers($url, 1);

E.

get_headers($url, ASSOC_HEADERS);

Question 10

What does the chown() function do?

Options:

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 11

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

Options:

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 12

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 13

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

Question 14

After performing the following operations:

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

$a = array_keys(array_flip($a));

What will be the value of $a?

Options:

A.

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

B.

array(2, 1, 0)

C.

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

D.

None of the above

Question 15

You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilities work?(Choose 2)

Options:

A.

echo $test(3)

B.

echo $test[2];

C.

echo $test(2);

D.

echo $test{2};

E.

echo $test{3}

Question 16

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)

Question 17

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

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

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 20

Which of the following functions are used to escape data within the context of HTML?

(Choose 2)

Options:

A.

htmlentities()

B.

addslashes()

C.

stripslashes()

D.

strip_tags()

E.

htmlspecialchars()

Question 21

How do you allow the caller to submit a variable number of arguments to a function?

Options:

A.

Using a prototype like function test(... $parameters).

B.

Using a prototype like function test() and the function func_get_args() inside the function body.

C.

Using a prototype like function test($parameters[]).

D.

Using a prototype like function test() and the function get_variable_args() inside the function body.

E.

This is not possible in PHP.

Question 22

How to read a single line, no matter how long from an file opened in the example below?

$fp = fopen("my_file.txt", "w");

Options:

A.

fgets($fp);

B.

fgets($fp, -1);

C.

fread($fp, 1024);

D.

fgetss($fp);

E.

None of the above

Question 23

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 24

What is the output of the following code?

1

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

Question 25

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

Options:

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 26

What function is ideal for outputting contents of a static file to screen?

Options:

A.

file_get_contents()

B.

readfile()

C.

fread()

D.

include()

E.

require()

F.

file()

Question 27

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.

Options:

A.

1)

B.

2)

C.

3)

D.

4)

E.

5)

F.

6)

Question 28

What function is used to retrieve all available information about a symbolic link?

Options:

A.

symlink()

B.

stat()

C.

fstat()

D.

lstat()

E.

readlink()

Question 29

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 30

What function can reverse the order of values in an array without the loss of key information?

Options:

A.

array_flip()

B.

array_reverse()

C.

rsort()

D.

krsort()

E.

array_multisort()

Question 31

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 32

Which is the most secure approach for handling dynamic data in SQL queries?

Options:

A.

Use addslashes().

B.

Enable magic_quotes_gpc.

C.

Use prepared statements if supported by the database library, data-specific escaping functions otherwise.

D.

Use stored procedures.

Question 33

Which SPL class implements fixed-size storage?

Options:

Question 34

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

Question 35

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 36

What is the output of the following code?

$a = 'a'; $b = 'b';

echo isset($c) ? $a.$b.$c : ($c = 'c').'d';

Options:

A.

abc

B.

cd

C.

0d

Question 37

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)

Question 38

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

Demo: 38 questions
Total 254 questions