Black Friday Special Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: mxmas70

Home > Zend > Zend Certification > 200-500

200-500 Zend PHP 5 Certification Question and Answers

Question # 4

How can a PHP extension be loaded? (Choose 2)

A.

ini_set("extension", "extension.so");

B.

dl("extension.so");

C.

extension_load("extension.so");

D.

extension=extension.so inside php.ini

Full Access
Question # 5

Which function can help prevent cross-site scripting? (Choose 2)

A.

addslashes()

B.

htmlentities()

C.

htmlspecialchars()

D.

strip_tags()

E.

quotemeta()

Full Access
Question # 6

What is the file locking mode that should be used when writing to a file?

A.

LOCK_UN

B.

LOCK_SH

C.

LOCK_EX

D.

LOCK_NB

Full Access
Question # 7

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

A.

the $_FILES super-global

B.

the input stream php://stdin

C.

the $_POST super-global

D.

the global variable scope

Full Access
Question # 8

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

Full Access
Question # 9

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

Full Access
Question # 10

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

Full Access
Question # 11

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

A.

A) rmdir()

B.

B) unlink()

C.

C) rm()

D.

D) delete()

E.

E) delete_file()

Full Access
Question # 12

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

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, ',', '.')

Full Access
Question # 13

An unbuffered query will: (Choose 2)

A.

Return the first data faster

B.

Return all data faster

C.

Free connection faster for others scripts to use

D.

Use less memory

Full Access
Question # 14

You want to parse a URL into its single parts. Which function do you choose?

A.

parse_url()

B.

url_parse()

C.

get_url_parts()

D.

geturlparts()

Full Access
Question # 15

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

Full Access
Question # 16

$_SERVER consists of data provided by the web server and is therefore trustworthy.

A.

TRUE

B.

FALSE

Full Access
Question # 17

Transactions are used to:

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

Full Access
Question # 18

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

Full Access
Question # 19

Webservices are primarily meant to support

A.

business-to-business communication

B.

machine-to-machine interaction

C.

improved accessibility for websites

Full Access
Question # 20

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)

Full Access
Question # 21

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

A.

levenshtein()

B.

metaphone()

C.

similar_text()

D.

soundex()

Full Access
Question # 22

You want to allow your users to submit HTML code in a form, which will then be displayed as real code and not affect your site layout. Which function do you apply to the text, when displaying it? (Choose 2)

A.

strip_tags()

B.

htmlentities()

C.

htmltidy()

D.

htmlspecialchars()

E.

showhtml()

Full Access
Question # 23

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

Full Access
Question # 24

Which of the following filtering techniques prevents cross-site scripting (XSS) vulnerabilities?

A.

Strip all occurrences of the string script.

B.

Strip all occurrences of the string javascript.

C.

Enable magic_quotes_gpc.

D.

None of the above.

Full Access
Question # 25

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

A.

(int)'t';

B.

ord('t');

C.

to_ascii('t');

D.

chr('t');

Full Access
Question # 26

An HTML form contains this form element:

When this form is submitted, the following PHP code gets executed:

1

2 move_uploaded_file(

3 $_FILES['myFile']['tmp_name'],

4 'uploads/' . $_FILES['myFile']['name']);

5 ?>

Which of the following actions must be taken before this code may go into production?

(Choose 2)

A.

Check with is_uploaded_file() whether the uploaded file $_FILES['myFile']['tmp_name'] is valid

B.

Sanitize the file name in $_FILES['myFile']['name'] because this value is not consistent among web browsers

C.

Check the charset encoding of the HTTP request to see whether it matches the encoding of the uploaded file

D.

Sanitize the file name in $_FILES['myFile']['name'] because this value could be forged

E.

Use $HTTP_POST_FILES instead of $_FILES to maintain upwards compatibility

Full Access
Question # 27

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

split(".", "

A.

B.C")

B.

2

C.

3

D.

1

E.

6

F.

4

Full Access
Question # 28

You analyze the code of a colleague and see a call to the function quotemeta(). You give the string "Holy $%&[. What's going on?" as a parameter to it. What will it output?

A.

Holy $%&[. What's going on?

B.

Holy \$%&\[\. What's going on\?

C.

Holy $%&[. What\'s going on?

D.

Holy \$\%\&\[\. What\'s going on\?

Full Access
Question # 29

Which requirements need NOT be met so that file uploads work?

A.

The PHP directive file_uploads must be set to On

B.

The form's method attribute must be set to "post"

C.

Safe mode must be turned off so that the uploaded file an be written to the server

D.

The form's enctype attribute must be set to "multipart/form-data"

Full Access
Question # 30

Which of the following statements is NOT correct?

A.

Only methods can have type hints

B.

Typehints can be optional

C.

Typehints can be references

Full Access
Question # 31

What is the output of the following code?

$a = 1;

++$a;

$a*=$a;

echo $a--;

A.

4

B.

3

C.

5

D.

0

E.

1

Full Access
Question # 32

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

Full Access