Ch5

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following is not a benefit of using the MVC pattern for an application? a. it's easier to make changes to the application b. web designers can work independently on the view c. there's less repetition of code d. it's easier to test and debug the application e. the application runs more efficiently

e. the application runs more efficiently

When you _______________________ an HTTP request, all processing takes place on the server before the response is returned to the browser.

forward

To make a variable that's declared outside a function available to the function, you must code the _________________________ keyword.

global

When you code a function in PHP, you can list one or more ____________________ that must be passed to the function.

parameters

(Refer to code example 5-1) Which of the following is a proper PHP statement for calling the function in this example and storing the returned result in a variable named $product. a. $product = get_product($product_id); b. $product = get_product(product_id); c. $product = $get_product($product_id); d. $product = $get_product(product_id);

a. $product = get_product($product_id);

One reason for using the header function to redirect a request a. is that it's more efficient than forwarding a request b. is to have a PHP file run itself again c. is to reduce the number of round trips that are required d. is to do all processing for the request on the server

a. is that it's more efficient than forwarding a request

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

a. make each layer as independent as possible

To call a function in PHP, you code the function name followed by a list of any _________________________ that are required.

arguments

When you use the header function to redirect a request, a. a response is sent to the web server so it requests another page b. the web server returns a new page to the browser c. a response is returned to the browser that tells it to request another page d. the web server returns a new page to the controller of the MVC pattern

c. a response is returned to the browser that tells it to request another page

function get_product($product_id) { global $db; $query = "SELECT * FROM products WHERE productID = '$product_id'"; $product = $db->query($query); $product = $product->fetch(); return $product; } (Refer to code example 5-1) What does this function return when it is called? a. an array of all the rows in the products table b. an array of all the rows with the specified category ID c. an array of the columns in the first row of the products table d. an array of the columns in the row with the specified product ID

d. an array of the columns in the row with the specified product ID

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. the model and the view

d. the model and the view

When you use the MVC pattern, the model consists of the PHP files that work with and represent the _________________________ of the application.

data

When you code a function in PHP, you start with the keyword __________________.

none

To pass data back to the statement that calls a function, the function can use the _________________________ statement.

return

When you use the MVC pattern, the ___________________ consists of the PHP files that make up the user interface of the application.

view


Conjuntos de estudio relacionados

Religion Philosophy Quiz: The Socratic Method

View Set

Management Final Exam - Chapter 8

View Set

Reading 39 Overview of Equity Securities

View Set

forensics - chapter 2 review questions

View Set

Math Lesson 49 Least Common Multiple

View Set

126 (E4) M6: Malabsorption Syndromes

View Set