Summer Special Sale - Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 575363r9

Welcome To DumpsPedia

200-500 Sample Questions Answers

Questions 4

When a class is defined as final it:

Options:

A.

Can no longer be extended by other classes.

B.

Means methods in the class are not over-loadable.

C.

Cannot be defined as such, final is only applicable to object methods.

D.

Is no longer iteratable.

Buy Now
Questions 5

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 6

You work for a shared hosting provider, and your supervisor asks you to disable user scripts to dynamically load PHP extensions using the dl() function. How can you do this? (Choose 2)

Options:

A.

Set enable_dl to Off in the server's php.ini configuration file.

B.

Add dl to the current value of disable_functions in the server's php.ini configuration file.

C.

Add dl to the current value of disable_classes in the server's php.ini configuration file.

D.

Write a custom function called dl(), save it under the name prepend.inc and then set the auto_prepend_file directive to prepend.inc in php.ini.

Buy Now
Questions 7

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 8

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 9

When uploading a file to a PHP script using the HTTP PUT method, where would the information about this file be available?

Options:

A.

the $_FILES super-global

B.

the input stream php://stdin

C.

the $_POST super-global

D.

the global variable scope

Buy Now
Questions 10

When 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

Buy Now
Questions 11

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 12

One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?

Options:

A.

html_display

B.

error_reporting

C.

display_errors

D.

error_log

E.

ignore_repeated_errors

Buy Now
Questions 13

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 14

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

$a = 2;

$b = 3;

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

Options:

A.

0

B.

5

C.

8

D.

4

Buy Now
Questions 15

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

Options:

A.

1

B.

2

C.

3

D.

4

Buy Now
Questions 16

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.

Buy Now
Questions 17

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

Buy Now
Questions 18

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

Options:

A.

xpathQuery()

B.

xpath()

C.

simpleXMLXpath()

D.

query()

E.

evaluate()

Buy Now
Questions 19

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 20

What SimpleXML function is used to parse a file?

Options:

A.

simplexml_load_file()

B.

simplexml_load_string()

C.

load()

D.

loadFile()

E.

loadXML()

F.

None of the above.

Buy Now
Questions 21

What is the result of the following code:

class T

{ const A

=

42 + 1;

}

echo T::A;

Options:

A.

42

B.

43

C.

Parse error

Buy Now
Questions 22

Which session function can help to avoid session fixation?

Options:

A.

session_is_registered()

B.

session_register()

C.

session_unregister()

D.

session_regenerate_id()

E.

None of the above.

Buy Now
Questions 23

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

Buy Now
Questions 24

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 25

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

Options:

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

Buy Now
Questions 26

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 27

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

Buy Now
Questions 28

What is the length of a string returned by: md5(rand(), TRUE);

Options:

A.

Depends on the value returned by rand() function

B.

32

C.

24

D.

16

E.

64

Buy Now
Questions 29

What is the maximum size of the VARCHAR column type?

Options:

A.

255 Bytes

B.

255 Characters

C.

512 Bytes

D.

512 Characters

E.

No Limit

Buy Now
Questions 30

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

Options:

A.

accept

B.

ok

C.

true

D.

on

Buy Now
Questions 31

Which options do you have in PHP to set the expiry date of a session?

Options:

A.

Set the session.duration directive in php.ini

B.

Set session cookie expiry date locally via session_set_cookie_params()

C.

Set session expiry date locally via session_cache_expire()

D.

None of the above

Buy Now
Questions 32

What is the return value of the following code?

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

Options:

A.

2

B.

3

C.

4

D.

0

E.

1

Buy Now
Questions 33

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

Options:

A.

bang bong bung

B.

bang bonged bung

C.

big bang bong bung

D.

big bang bung

Buy Now
Questions 34

REST is a(n) ...

Options:

A.

Web service protocol similar to SOAP with a strict XML schema.

B.

Principle to exchange information using XML and HTTP.

C.

API to get information from social networking sites.

Buy Now
Questions 35

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

Options:

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.

Buy Now
Questions 36

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

Buy Now
Questions 37

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 38

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 39

Which of the following statements are NOT true?

Options:

A.

SimpleXML allows removal of attributes.

B.

SimpleXML allows addition of new attributes.

C.

SimpleXML allows removal of nodes.

D.

SimpleXML allows addition of new nodes.

E.

None of the above

Buy Now
Questions 40

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

Options:

A.

$_SERVER

B.

$_ENV

C.

$GLOBALS

D.

$_POST

E.

$_ARGV

Buy Now
Questions 41

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

Buy Now
Questions 42

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

Buy Now
Questions 43

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

Options:

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

Buy Now
Questions 44

Which of the following are valid identifiers (Choose 3)

Options:

A.

function 4You() { }

B.

function _4You() { }

C.

function object() { }

D.

$1 = "Hello";

E.

$_1 = "Hello World";

Buy Now
Questions 45

You want to present the following formatted number: "999.000.000,00". Which function call is correct?

Options:

A.

print format_number(999000000);

B.

print number_format(999000000);

C.

print number_format(999000000, 2, ',', '.');

D.

print number_format(999000000, 2);

E.

print_number(999000000, 2, ',', '.')

Buy Now
Questions 46

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

Buy Now
Questions 47

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

Buy Now
Questions 48

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 49

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

Buy Now
Questions 50

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

Buy Now
Questions 51

In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this?

Options:

A.

Store session data in a different location with session.save_path

B.

Store session data in a database.

C.

Enable safe_mode.

D.

Set session.name to something unique.

Buy Now
Questions 52

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

Buy Now
Questions 53

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\>.

Buy Now
Questions 54

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 55

Which of the following XML declarations is NOT valid?

Options:

A.

B.

C.

D.

Buy Now
Questions 56

What is the purpose of the open_basedir directive?

Options:

A.

Provide a list of directories where PHP should search for files.

B.

Provide a list of directories from which PHP can open files.

C.

Provide a list of directories from which PHP cannot open files.

D.

Directory where the PHP extensions can be found.

Buy Now
Questions 57

What object method specifies post-serialization behavior for an object?

Options:

A.

__sleep()

B.

__wakeup()

C.

__set_state()

D.

__get()

E.

__autoload()

Buy Now
Questions 58

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

Options:

A.

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

B.

isset($a['key'])

C.

array_key_exists('key', $a)

D.

None of the above

Buy Now
Questions 59

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 60

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

Options:

A.

implements

B.

instanceof

C.

static

D.

abstract

Buy Now
Questions 61

What will the following code piece print?

echo strtr('Apples and bananas', 'ae', 'ea')

Options:

A.

Applas end benenes

B.

Epplas end benenes

C.

Apples and bananas

D.

Applas end bananas

Buy Now
Questions 62

Assume that you are using PHP s session management without cookies and want to make sure that session information does not get lost when redirecting the client to another URL. Which of the following functions do you need to achieve that? (Choose 3)

Options:

A.

header()

B.

session_id()

C.

session_info()

D.

session_name()

E.

session_write_close()

Buy Now
Questions 63

How many array elements will be found in the return value of:

split(".", "

Options:

A.

B.C")

B.

2

C.

3

D.

1

E.

6

F.

4

Buy Now
Questions 64

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

Buy Now
Questions 65

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
Exam Code: 200-500
Exam Name: Zend PHP 5 Certification
Last Update: May 1, 2025
Questions: 219
$66  $164.99
$50  $124.99
$42  $104.99
buy now 200-500