How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object
found inside $xml?
A. $xml->getElementById('2');
B. $xml->foo->bar->baz[2]['id']
C. $xml->foo->baz[2]['id']
D. $xml->foo->bar->baz[1]['id']
E. $xml->bar->baz[1]['id']
Which of the following is NOT true about PHP traits? (Choose 2)
A. Multiple traits can be used by a single class.
B. A trait can implement an interface.
C. A trait can declare a private variable.
D. Traits are able to be auto-loaded.
E. Traits automatically resolve conflicts based on definition order.
Consider the following table data and PHP code. What is the outcome? Table data (table name "users" with primary key "id"):
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 * FROM users WHERE id = :id";
$stmt = $pdo->prepare($cmd);
$id = 3;
$stmt->bindParam('id', $id);
$stmt->execute();
$stmt->bindColumn(3, $result);
$row = $stmt->fetch(PDO::FETCH_BOUND);
A. The database will return no rows.
B. The value of $row will be an array.
C. The value of $result will be empty.
D. The value of $result will be '[email protected]'.
Which of the following may be used in conjunction with CASE inside a SWITCH statement?
A. A scalar
B. An expression
C. A boolean
D. All of the above
Consider the following code. What change must be made to the class for the code to work as written?
class Magic {
protected $v = array("a" => 1, "b" => 2, "c" => 3);
public function __get($v) {
return $this->v[$v];
}
}
$m = new Magic();
$m->d[] = 4;
echo $m->d[0];
A. Nothing, this code works just fine.
B. Add __set method doing $this->v[$var] = $val
C. Rewrite __get as: public function __get(and$v)
D. Rewrite __get as: public function and__get($v)
E. Make __get method static
What is the output of the following code?
try {
class MyException extends Exception {};
try {
throw new MyException;
}
catch (Exception $e) {
echo "1:";
throw $e;
}
catch (MyException $e) {
echo "2:";
throw $e;
}
}
catch (Exception $e) {
echo get_class($e);
}
A. A parser error, try cannot be followed by multiple catch
B. 1:
C. 2:
D. 1:Exception
E. 1:MyException
F. 2:MyException
G. MyException
What is the result of the following code?
class T
{
const A = 42 + 1;
}
echo T::A;
A. 42
B. 43
C. Parse error
What is the output of the following code? var_dump(boolval(-1));
A. bool(true)
B. bool(false)
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 [email protected]
2 betty [email protected]
3 clara [email protected]
5 sue [email protected]
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', '[email protected]');
$stmt->execute();
echo "Success!";
} catch (PDOException $e) {
echo "Failure!";
throw $e;
}
A. The INSERT will succeed and the user will see the "Success!" message.
B. The INSERT will fail because of a primary key violation, and the user will see the "Success!" message.
C. The INSERT will fail because of a primary key violation, and the user will see a PDO warning message.
D. The INSERT will fail because of a primary key violation, and the user will see the "Failure!" message.
When a class is defined as final it:
A. Can no longer be extended by other classes.
B. Means methods in the class are not over-loadable.
C. Cannot be defined as such, final is only applicable to object methods.
D. Cannot be instantiated.
Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Zend exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 200-710 exam preparations and Zend certification application, do not hesitate to visit our Vcedump.com to find your solutions here.