CIST2351-PHP Programming I - Midterm Prep

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

CODE EXAMPLE 3-1 SELECT vendorName, invoiceNumber, invoiceDate, invoiceTotal FROM vendors INNER JOIN invoices ON vendors .vendorID = invoices.vendorID WHERE invoiceTotal >= 500 ORDER BY vendorName DESC How many columns will the result set have?

4

If a PHP array contains 7 elements, what is the number of the index of the seventh element?

6

Which character is used to separate the original URL from the parameters that are appended to it?

?

_____ are used in PHP to perform mathematical calculations, such as addition.

Arithmetic operators

A _____ value is a value of true or false.

Boolean

Which of the following is NOT a common MySQL data type?

DBL

The _____ for a MySQL connection specifies the host computer for the MySQL database and the name of the database.

DSN (Data Source Name)

Which method of the form appends values to the URL to pass data?

GET

What type of SQL statement is used to assign user privileges in MySQL?

GRANT

Which of the following is NOT a common MySQL privilege?

Insert TABLE

What does the acronym MVC stand for?

Module-View-Controller

Which of the following is a class used for errors thrown by the PDO library?

PDIException

Which PHP class can be used to connect to a MySQL database?

PDO

Which of the following is NOT a database server that can be used for dynamic Web pages?

Python

Assume that the statements that follow get the data from a text area named comments. After these statements are executed, how will the $comments_esc variable be displayed by an echo statement? $comments = filter_input(INPUT_POST, 'comments'); $comments_esc = htmlspecialchars($comments);

With character entities for special characters

When you code a DELETE statement, you usually need to include:

a WHERE clause

A request and response for a file are made by

a client and a server

When you use the header function to redirect a request,

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

CODE EXAMPLE 3-1 SELECT vendorName, invoiceNumber, invoiceDate, invoiceTotal FROM vendors INNER JOIN invoices ON vendors .vendorID = invoices.vendorID WHERE invoiceTotal >= 500 ORDER BY vendorName DESC If vendorName contains string data and invoiceTotal contains decimal values, how will the result set be ordered?

alphabetically starting with Z

A join that returns records from related tables only if their related fields match is called:

an inner join

To make it easier to enter names into your code, NetBeans provides a feature known as

auto-completion

A web application is a type of _____ .

client/server application

A _____ contains a value that does not change during the course of program execution.

constant

A hidden field:

doesn't appear on the form but its data is sent to the server

The equality operator consists of two _____ signs and performs a different function than the one performed by the assignment operator that consists of a single sign.

equal

A/An _____ is an object that contains information about an error.

exception

Which of the following is an object that contains information about an error that occurred?

exception

What is the goal of testing an application before it is put into production?

find all errors

The goal of testing is to

find all errors in the application

Which of the following can be used to get the data from an array that contains all rows of a result set?

foreach statement

The HTTP response for a dynamic web page is passed

from the web server to the browser

Which function can be used to redirect a request to another URL?

header

Which PHP function convert some special characters into character entities?

htmlspecialchars

Which function can be used to forward a request from one PHP file to another?

include

A(n) _____ is a positive or negative number with no decimal places.

integer

A PHP variable name:

is case-sensitive

One reason for using the header function to redirect a request

is to have a PHP file run itself again

Which type of error does not cause the PHP interpreter to display errors, but may produce incorrect output?

logic

Which type of error is often the most difficult to find and fix?

logic

Which attribute of a form element determines how the data is passed to a file?

method

Which optional attribute of a select element allows the user to select more than one option in a list box?

multiple

Which keyword is used to create an object from a class in PHP?

new

When creating a function, _____ can be included in the parentheses that follow the name.

parameters

What does a relational database use to uniquely identify each row in a table?

primary keys

The first part of a URL is called the

protocol

Which type of input element should be used on a form when the user can select only one of the options?

radio

Which of the following is a term that refers to modifying the organization or structure of an application?

refactoring

Which type of error does not violate the rules for how PHP statements must be written but still will cause the PHP interpreter to display errors?

runtime

The type of error that does not violate syntax rules, but causes the PHP interpreter to display errors is called

runtime error

Which HTML element is used to create a drop-down list?

select

How many data types are used by PHP?

six

Which type of error is considered the easiest to fix?

syntax

Which of the following is NOT a benefit of using the MVC pattern for an application?

the application runs more efficiently

To deploy a PHP application on your own computer, you copy the application root directory to

the htdocs directory of the Apache server

When you use the MVC pattern, the controller gets the HTTP requests and then directs the use of the files that represents:

the model and the view

To handle exceptions, first you code a/an _____ around any PHP statements that might throw an exception>

try block

To run a PHP application that has been deployed on your own computer, you can enter a URL in the address bar of your browser that

uses localhost as the domain name

CODE EXAMPLE 3-1 SELECT vendorName, invoiceNumber, invoiceDate, invoiceTotal FROM vendors INNER JOIN invoices ON vendors .vendorID = invoices.vendorID WHERE invoiceTotal >= 500 ORDER BY vendorName DESC What table(s) does the data in the result set come from?

vendors and invoices

Which of the following consists of the PHP and HTML files that represent the user interface of the application?

view

The column definition for a MySQL table can be used to determine all but one of the following. Which one is it?

what range of values the column can contain

What is the goal of debugging an application before it is put into production?

fix all errors

Which of the following lists the functions in the reverse order in which they were called?

stack trace

When HTML was first developed, Web pages were typically

static

Assume that the POST method is used. Which of the following statmenbts gets the value of the radio button that's on in the delivery group and stores it in a variable named $card_type?

$card_type = filter_input(INPUT_POST, 'delivery');

To round and format the value of a variable named $number to 3 decimal places and store it in a variable named $number_formatted, you code:

$number_formatted = number_format($number, 3);

What extension of a filename is typically associated with a static Web page?

.html

If $total_months has a value of 13, what does $message contain after this if statement is executed? $years = $total_months/12; $years = number_format($years); $months = $total_months % 12: if ( $years == 0 ) { $messgae = $months . "months"; } else if ( $months == 0 ) { $messgae = $years . "years"; } else { $message = $years . "years, and " . $months . " months"; }

1 years, and 1 months

What will $future_value contain after the for loop that follows has been executed one time? $years = 10; $annual_rate = 10; $future_value = 1000; $annual_rate = $annual_rate / 100;>br>for ($i = 1; $i <= $years; $i++ ) { $future_value = $future_value * (1 + $annual_rate); }

1100

To execute a prepared SQL statement, you can use the _____ and execute methods of the PDOStatement object to set parameter values and execute the statement

bindValue


Kaugnay na mga set ng pag-aaral

Incorrect answers in Must Be True questions

View Set

Ionic Bonding and Ionic Compounds Study Guide

View Set

Chapter 1 : External vs. Internal Users

View Set

homophones with ai a_e tale tail

View Set

Chapter 7 Social Psychology : Persuasive Communication

View Set