PrepAway - Latest Free Exam Questions & Answers

Category: 200-550

Exam 200-550: Zend Certified PHP Developer

What is the outcome?

Consider the following table data and PHP code. 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 { $cmd = “INSERT INTO users (id, name, email)
VALUES (:id, :name, :email)”; $stmt = $pdo->prepare($cmd); $stmt->bindValue(‘id’, 1);
$stmt->bindValue(‘name’, ‘anna’); $stmt->bindValue(’email’, ‘alpha@example.com’);
$stmt->execute(); echo “Success!”; } catch (PDOException $e) { echo “Failure!”; throw $e; }

What is a possible outcome?

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

What is the outcome?

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


Page 6 of 23« First...45678...20...Last »