1.
To create a PDO object, you code the _____________________ keyword, followed by PDO, followed by the three arguments that it requires.
2.
To execute a SELECT statement, you use the _____________________ method of the PDO object that connects to the database.
3.
To execute an INSERT statement, you use the _____________________ method of the PDO object that connects to the database.
4.
To handle the PDO exceptions that can occur when database methods are executed, you use a _____________________ statement.
5.
To access one of the elements in an array, you code the array name and a set of brackets that contains the _______________________ of the element you want to access.
6.
To return an array for the first row of a result set that’s returned by a SELECT statement, you use the fetch method of the _____________________________ object that represents the result set.
7.
To access the data for all of the rows in a result set that’s returned by a SELECT statement, you can use a _____________________________ loop.
8.
What date did you complete this worksheet _____________________________ .
9.
When you create a PDO object, you have to pass all but one of these arguments to it: Which one is it?
A. 
B. 
C. 
D. 
10.
In the catch block of a try/catch statement for handling PDO exceptions, you can get a message that describes the exception by using the getMessage method of the
A. 
B. 
C. 
D. 
11.
Which of the following is the correct way to code a PHP statement that returns the result set for a SELECT statement that’s stored in $statement if the PDO object is $db?
A. 
$results = $db->query($statement);
B. 
$results = $db->exec($statement);
C. 
$results = query->$db($statement);
D. 
$results = exec->$db($statement);
12.
Which of the following is the correct way to code a PHP statement that puts the first row of PDOStatement object named $products in an array named $product?
A. 
$product = $db->query($products);
B. 
$product = $db->fetch($products);
C. 
$product = $products->query();
D. 
$product = $products->fetch();
13.
Code example 4-1
The starting code for the index.php file which is the first page of an application
(Refer to code example 4-1) The first statement in this example gets and runs a file named database.php. What must this code do for the rest of the statements in this example to work?
A. 
Create a PDOStatement object named $db that connects to the right database
B. 
Create a PDOStatement object named $db-> that connects to the right database
C. 
Create a PDO object named $db that connects to the right database
D. 
Create a PDO object named $db-> that connects to the right database
14.
Code example 4-1
The starting code for the index.php file which is the first page of an application
<?php
require 'database.php';
$category_id = $_GET['category_id'];
if (!isset($category_id)) {
$category_id = 1;
}
// Routine 1
$query = "SELECT * FROM categories
WHERE categoryID = $category_id";
$category = $db->query($query);
$category = $category->fetch();
$category_name = $category['categoryName'];
// Routine 2
$query = "SELECT * FROM products
WHERE categoryID = $category_id
ORDER BY productID";
$products = $db->query($query);
?>
(Refer to code example 4-1) What does routine 1 store in the variable named $category_name?
A. 
The category name for the first row in the categories table of the database
B. 
The category name for the row in categories table that corresponds to the value in $category_id
C. 
The category name for the row in categories table that has a category ID of 1
D. 
An array of the category names in the categories table
15.
Code example 4-1
The starting code for the index.php file which is the first page of an application
(Refer to code example 4-1) What does routine 2 store in the variable named $products?
A. 
A PDOStatement object for all rows in the products table
B. 
A PDOStatement object for the columns in the first row in the products table
C. 
A PDOStatement object for the rows in the products table that have a category ID equal to the value in $category_id
D. 
A PDOStatement object for the rows in the products table that have a category ID equal to 1
16.
When you use the MVC pattern, the model consists of the PHP files that work with and represent the _________________________ of the application.
17.
When you use the MVC pattern, the ___________________ consists of the PHP files that make up the user interface of the application.
18.
When you code a function in PHP, you start with the keyword __________________.
19.
When you code a function in PHP, you can list one or more ____________________ that must be passed to the function.
20.
To call a function in PHP, you code the function name followed by a list of any _________________________ that are required.
21.
To make a variable that’s declared outside a function available to the function, you must code the _________________________ keyword.
22.
When you _______________________ an HTTP request, all processing takes place on the server before the response is returned to the browser.
23.
To pass data back to the statement that calls a function, the function can use the _________________________ statement.
24.
When you use the MVC pattern, the controller gets the HTTP requests and then directs the use of the files that represent
A. 
The model, the view, and the database
B. 
The database and the view
C. 
The model, the view, and the user interface
D. 
25.
When you use the MVC pattern, you
A. 
Make each layer as independent as possible
B. 
Perform all data validation on the client
C. 
Use the pattern for every page in the application
D. 
Put all of the PHP code in the controller