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

Viewing page 3 out of 7 pages
Viewing questions 21-30 out of questions
Questions # 21:

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

Options:

A.

xpathQuery()


B.

xpath()


C.

simpleXMLXpath()


D.

query()


E.

evaluate()


Expert Solution
Questions # 22:

Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2)

$obj = new C();

foreach ($obj as $x => $y) {

echo $x, $y;

}

Options:

A.

Iterator


B.

ArrayAccess


C.

IteratorAggregate


D.

ArrayObject


Expert Solution
Questions # 23:

Given the following code, what is correct?

function f(stdClass &$x = NULL) { $x = 42; }

$z = new stdClass;

f($z);

var_dump($z);

Options:

A.

Error: Typehints cannot be NULL


B.

Error: Typehints cannot be references


C.

Result is NULL


D.

Result is object of type stdClass


E.

Result is 42


Expert Solution
Questions # 24:

Which PHP function sets a cookie and URL encodes its value when sending it to the browser?


Expert Solution
Questions # 25:

Transactions should be used to: (Choose 2)

Options:

A.

Prevent errors in case of a power outage or a failure in the SQL connection


B.

Ensure that the data is properly formatted


C.

Ensure that either all statements are performed properly, or that none of them are.


D.

Recover from user errors


Expert Solution
Questions # 26:

Consider the following table data and PHP code. What is a possible outcome?

Table data (table name "users" with primary key "id"):

id name email

------- ----------- -------------------

1 anna alpha@example.com

2 betty beta@example.org

3 clara gamma@example.net

5 sue sigma@example.info

PHP code (assume the PDO connection is correctly established):

$dsn = 'mysql:host=localhost;dbname=exam';

$user = 'username';

$pass = '********';

$pdo = new PDO($dsn, $user, $pass);

$cmd = "SELECT name, email FROM users LIMIT 1";

$stmt = $pdo->prepare($cmd);

$stmt->execute();

$result = $stmt->fetchAll(PDO::FETCH_BOTH);

$row = $result[0];

Options:

A.

The value of $row is `array(0 => 'anna', 1 => 'alpha@example.com')`.


B.

The value of $row is `array('name' => 'anna', 'email' => 'alpha@example.com')`.


C.

The value of $row is `array(0 => 'anna', 'name' => 'anna', 1 => 'alpha@example.com', 'email' => 'alpha@example.com')`.


D.

The value of $result is `array('anna' => 'alpha@example.com')`.


Expert Solution
Questions # 27:

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

$str = "The cat sat on the roof of their house.";

$matches = preg_split("/(the)/i", $str, -1, PREG_SPLIT_DELIM_CAPTURE);

Options:

A.

2


B.

3


C.

4


D.

7


E.

9


Expert Solution
Questions # 28:

What is the output of the following code?

for ($i = 0; $i < 1.02; $i += 0.17) {

$a[$i] = $i;

}

echo count($a);

Options:

A.

0


B.

1


C.

2


D.

6


E.

7


Expert Solution
Questions # 29:

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

$getdata = "foo=bar";

$opts = array('http' =>

array(

'method' => 'POST',

'header' => 'Content-type: application/x-www-form-urlencoded',

'content' => $getdata

)

);

$context = stream_context_create($opts);

$result = file_get_contents('http://example.com/submit.php', false, $context);

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


Expert Solution
Questions # 30:

What is the output of the following code?

var_dump(boolval(-1));

Options:

A.

bool(true)


B.

bool(false)


Expert Solution
Viewing page 3 out of 7 pages
Viewing questions 21-30 out of questions