Free 200-550 Exam Braindumps (page: 15)

Page 14 of 56

Consider the following table data and PHP code, and assume that the database supports transactions. What is the 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);
try {
$pdo->exec("INSERT INTO users (id, name, email) VALUES (6, 'bill', 'delta@example.com')");
$pdo->begin();
$pdo->exec("INSERT INTO users (id, name, email) VALUES (7, 'john', 'epsilon@example.com')");
throw new Exception();
} catch (Exception $e) {
$pdo->rollBack();
}

  1. The user 'bill' will be inserted, but the user 'john' will not be.
  2. Both user 'bill' and user 'john' will be inserted.
  3. Neither user 'bill' nor user 'john' will be inserted.
  4. The user 'bill' will not be inserted, but the user 'john' will be.

Answer(s): A



Given a PHP value, which sample shows how to convert the value to JSON?

  1. $string = json_encode($value);
  2. $string = Json::encode($value);
  3. $json = new Json($value); $string = $json->__toString();
  4. $value = (object) $value; $string = $value->__toJson();

Answer(s): A



Given a JSON-encoded string, which code sample correctly indicates how to decode the string to native PHP values?

  1. $json = new Json($jsonValue); $value = $json->decode();
  2. $value = Json::decode($jsonValue);
  3. $value = json_decode($jsonValue);
  4. $value = Json::fromJson($jsonValue);

Answer(s): C



Which of the following PHP values may NOT be encoded to a JavaScript literal using PHP's ext/json capabilities?

  1. 'Hello, world!'
  2. function(){ alert("Hello, world!"); }
  3. array('Hello, world!')
  4. array('message' => 'Hello, world!')

Answer(s): B






Post your Comments and Discuss Zend 200-550 exam with other Community members:

200-550 Discussions & Posts