Pass the Zend PHP and Zend Framework Certifications 200-550 Questions and answers with CertsForce

Viewing page 2 out of 7 pages
Viewing questions 11-20 out of questions
Questions # 11:

What is the output of this code?

$world = 'world';

echo <<<'TEXT'

hello $world

TEXT;

Options:

A.

hello world


B.

hello $world


C.

PHP Parser error


Expert Solution
Questions # 12:

When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)

Options:

A.

$default_opts = array('http'=>array('user_agent'=>"My Cool Browser"));

$default = stream_context_set_default($default_opts);


B.

stream_context_set_option("user_agent", "My Cool Browser");


C.

ini_set('user_agent', "My Cool Browser");


D.

stream_context_set_option($context, "http", "user_agent", "My Cool Browser");


Expert Solution
Questions # 13:

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

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.


Expert Solution
Questions # 14:

Which of the following statements about anonymous functions in PHP are NOT true? (Choose 2)

Options:

A.

Anonymous functions can be bound to objects


B.

Anonymous functions created within object context are always bound to that object


C.

Assigning closure to a property of an object binds it to that object


D.

Methods bind() and bindTo() of the Closure object provide means to create closures with different binding and scope


E.

Binding defines the value of $this and the scope for a closure


Expert Solution
Questions # 15:

Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)

Options:

A.

file_put_contents("target.txt", fopen("source.txt", "r"));


B.

file_put_contents("target.txt", readfile("source.txt"));


C.

file_put_contents("target.txt", join(file("source.txt"), "\n"));


D.

file_put_contents("target.txt", file_get_contents("source.txt"));


E.

$handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle);


Expert Solution
Questions # 16:

You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize *as much as possible* the length of the class name you have to type. What would you do?

Options:

A.

Import the MyGreatFramework namespace


B.

Import the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace


C.

Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer\MyDBConnection to a shorter name


D.

Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer to a shorter name


Expert Solution
Questions # 17:

PHP's array functions such as array_values() 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


Expert Solution
Questions # 18:

Which of the following can NOT be used to send a cookie from within a PHP application?

Options:

A.

header()


B.

$_COOKIE


C.

setcookie()


D.

setrawcookie()


Expert Solution
Questions # 19:

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

1 ^ 2

Options:

A.

1


B.

3


C.

2


D.

4


E.

-1


Expert Solution
Questions # 20:

Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'?

Options:

A.

$datetime->format('%Y-%m-%d %h:%i:%s')


B.

$datetime->format('%Y-%m-%d %h:%i:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))


C.

$datetime->format('Y-m-d H:i:s')


D.

$date = date('Y-m-d H:i:s', $datetime);


Expert Solution
Viewing page 2 out of 7 pages
Viewing questions 11-20 out of questions