Server Side Web Programming Final

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

None of the conditions in the if or elseif clauses are true

In an if statement, the statements in the else clause are executed if the condition in the if clause isn't true none of the conditions in the elseif clauses are true none of the conditions in the if or elseif clauses are true

PDOException object

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 PDO object PDOStatement object PDOException object Result set array

Is to have a php file run itself again

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

4

SELECT vendorName, invoiceNumber, invoiceDate, invoiceTotalFROM vendors INNER JOIN invoicesON vendors.vendorID = invoices.vendorIDWHERE invoiceTotal >= 500ORDER BY vendorName DESC (Refer to code example 3-1.) How many columns will the result set have? 4 5 6 7

From the web server to the browser

The HTTP response for a dynamic web page is passed

PHP Data Objects

The ________________ extension to PHP defines an interface for accessing databases. SQL Data Objects PHP Data Objects PHP_SQL PDO_EXT

DSN

The ________________ for a MySQL connection specifies the host computer for the MySQL database and the name of the database. username password DSN (Data Source Name) server name

What range of values the column can contain

The column definition for a MySQL table can be used to determine all but one of the following. Which one is it? what type of data the column can contain whether the column can contain a null value whether the column has a default value what range of values the column can contain

Equal

The equal operator consists of two ________________ signs and performs a different function than the one performed by the assignment operator that consists of a single sign. percent greater than equal division

Protocol

The first part of a URL is called the a) protocol b) domain identifier c) directory d) filename

Cell

The intersection of a column and row in a database table can be called a cell box slot plot

Increment operations to be done first

The order of precedence for arithmetic expressions causes addition to be done before subtraction multiplication to be done before division increment operations to be done first modulus operations to be done last

Two of the columns from the accounts table where balance is less than 0

The result set retrieved by the following SELECT statement contains rows that haveSELECT balance, numberFROM accountsWHERE balance < 0 all of the columns from the accounts table two of the rows from the account table all of the columns from the accounts table where balance is less than 0 two of the columns from the accounts table where balance is less than 0

Index

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. number name index id

Privileges

To control what users can do with a database, SQL can be used to assign ________________ to users. permissions privileges passwords keys

The htdocs directory of the apache server

To deploy a PHP application on your own computer, you copy the application root directory to a) the htdocs directory of the MySQL server b) the xampp directory of the Apache server c) the xampp directory of the MySQL server d) the htdocs directory of the Apache server

fetchAll()

To get an array for all rows in a result set, you can call the ________________ method of the PDOStatement object for the result set. fetch() fetchAll() get() getAll()

Try block

To handle exceptions, first you code a/an ________________ around any PHP statements that might throw an exception. method try/catch statement try block MySQL statement

Try/catch

To handle the PDO exceptions that can occur when database methods are executed, you use a ________________ statement. on-error if/else try/catch handle-exception

Index

To refer to the elements in an array, you use a string or numeric ________________. id index locator pointer

fetch()

To return an array for the first row of a result set that's returned by a SELECT statement, you use the ________________ method of the PDOStatement object for the result set. fetch() fetchFirst() get() getFirst()

$number_formatted = number_format($number, 3);

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, round); $number_formatted = number_format($number, 3); $number_formatted = format_number($number, 3, round); $number_formatted = format_number($number, 3);

Uses localhost as the domain name

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 a) uses apache as the domain name b) specifies just the application root directory and the starting filename c) uses localhost as the domain name d) specifies just the application root directory

Right-clicking on the page

To view the source code for a web page in a web browser, you can display the View Page Source command by a) clicking on the File menu b) none of the above c) right-clicking on the page d) restarting the browser

Uniform Resource Locator

URL stands for a) Universal Refresh Location b) Unique Register Location c) Uniform Resource Locator d) Undeclared Resource Location

The data type

What attribute of a column determines the data that can be stored in the column? the default value the data type whether it can contain null values whether it's auto-incremented

Foreign keys

What does a relational database use to relate the tables in a database to other tables? indexes foreign keys non-primary keys primary keys

Primary keys

What does a relational database use to uniquely identify each row in a table? indexes foreign keys non-primary keys primary keys

Model-View-Controller

What does the acronym MVC stand for? Model-View-Controller Most-Valuable-Computer programmer Mixed-Vector-CPU Must-Verify-Constraints

.htm

What extension of a filename is typically associated with a static Web page? a) .pl b) .htm c) .asp d) .php

Period

What is the concatenation operator in PHP? ampersand (&) plus sign (+) period (.) pound sig (#)

New

What keyword must you code to create a PDO object? create make pdo new

Domain name

What part of a URL identifies the web server that an HTTP request will be sent to? a) web name b) domain path c) web path d) domain name

Web browser

What software does a client use to access the web server where a web application resides?

HTTP

What type of a request does a web browser typically send to a server? a) TCP/IP b) FTP c) IPsec d) HTTP

Dynamic

What type of web pages are generated by PHP scripts that are running on the web server?

1100

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;for ( $i = 1; $i <= $years; $i++ ) {$future_value = $future_value * (1 + $annual_rate);}

Name: Bob

What will the variable $name contain after the code that follows is executed?$first_name = 'Bob';$last_name = 'Roberts';$name = "Name: $first_name"; Name: 'Bob' Name: Bob Name: 'Bob Roberts' Name: Bob Roberts

Current

When coding relative URLs, you can begin the URL with a single dot (.) to indicate that the URL should start with the ________________ directory. root parent current child

PHP Interpreter

When the web server receives an HTTP request for a PHP page, the web server calls the

Server name

When you create a PDO object, you have to pass all but one of these arguments to it: Which one is it? Data source name Server name User name Password

The model and the view

When you use the MVC pattern, the controller gets the HTTP requests and then directs the use of the files that represent the model, the view, and the database the database and the view the model, the view, and the user interface the model and the view

Make each layer as independent as possible

When you use the MVC pattern, you make each layer as independent as possible perform all data validation on the client use the pattern for every page in the application put all of the PHP code in the controller

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

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

PDO

Which PHP class can be used to connect to a MySQL database? db PDO DataConnect argument

Method

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

&

Which character is used to separate parameters that are appended to a URL? $ & ? =

SELECT

Which clause in a SQL statement specifies the columns to return? SELECT FROM WHERE ORDER BY

WHERE

Which clause in a SQL statement specifies the records to return based on criteria? SELECT FROM WHERE ORDER BY

FROM

Which clause in a SQL statement specifies the table(s) that should supply the data that is returned? SELECT FROM WHERE ORDER BY

New

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

POST

Which method of the form passes data without appending the parameters to the URL? GET POST ACTION APPEND

B or C

Which of the following assigns a string literal to a variable? $name = Tom $name = 'Tom' $name = "Tom" B or C

$_GET

Which of the following built-in arrays do you use in PHP to get the data that is submitted with an HTTP GET request? $GET $_GET $HTTP_GET $_HTTP_GET

Delete the rows

Which of the following can a SELECT statement NOT do to the data in a table? Get selected rows Get selected columns Sort the rows Delete the rows

All of these

Which of the following can be displayed if you omit the filename of a URL? a) index.htm b) index.html c) index.php d) all of these

foreach statement

Which of the following can be used to get the data from an array that contains all rows of a result set? roll over fetch() method foreach statement forall loop

Application runs more efficiently

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

DBL

Which of the following is NOT a common MySQL data type? CHAR VARCHAR INT DBL

INSERT TABLE

Which of the following is NOT a common MySQL privilege? INSERT TABLE SELECT UPDATE DELET

Python

Which of the following is NOT a database server that can be used for dynamic Web pages? a) SQL Server b) Oracle c) MySQL d) Python

Node

Which of the following is NOT part of an HTTP URL: a) filename b) path c) node d) protocol

Like MySQL, it is owned by Oracle

Which of the following is NOT true about MariaDB? a) It is being maintained by many of the original developers of MySQL. b) Like MySQL, it is owned by Oracle. c) Newer versions of XAMPP use MariaDB rather than MySQL. d) One goal is to maintain high compatibility with MySQL.

filter_input()

Which of the following is a PHP function that you should always use when getting values from a superglobal array? get_data() get_input() filter_data() filter_input()

INSERT

Which of the following is a SQL statement that you can use to add a row to a database? ADD UPDATE MODIFY INSERT

SELECT

Which of the following is a SQL statement that you can use to retrieve data from a SQL database? GET RETRIEVE SELECT RESULT

PDOException

Which of the following is a class used for errors thrown by the PDO library? PDOException PDOCatch PDOHandler CatchException

fetch()

Which of the following is a method of the PDOStatement class that returns an array for the next row in a result set? fetch() next() getArray() getRow()

Apache

Which of the following is a web server that is commonly used for web applications that are written in PHP? a) IIS b) NetBeans c) XAMPP d) Apache

Exception

Which of the following is an object that contains information about an error that occurred? catch exception handler block

Apache

Which of the following is software that is a web server? a) phpMyAdmin b) Apache c) MySQL d) htdocs

Web server

Which of the following is used to make websites available to other computers over a network?

PHP

Which of the following software components generates the HTML that is returned in an HTTP response?

Code two slashes followed by the comment

Which of the following techniques can you use to code a comment at the end of a line of code? Code two slashes (//) followed by the comment Code a dollar sign ($) followed by the comment Code /* followed by the comment and */ all of these

Code /* followed by the comment and */

Which of the following techniques can you use to code a multi-line comment? code two slashes (//) followed by the comment and two slashes code a dollar sign ($) followed by the comment and a dollar sign code /* followed by the comment and */ all of these

Script file

You can use phpMyAdmin to import and run a SQL ________________ that creates one or more databases. batch file script file exec file include file

Arithmetic operators

________________ are used in PHP to perform mathematical calculations, such as addition. Arithmetic operators Binary operators Unary operators Bitwise operators

-- QUIZ 2 --

-- QUIZ 2 --

-- QUIZ 3 --

-- QUIZ 3 --

-- QUIZ 5 --

-- QUIZ 5 --

-- QUIZ 4 --

-- Quiz 4 --

<?php

A PHP tag that's embedded within HTML starts with <php <php? <?php <?

Constant

A ________________ contains a value that does not change during the course of program execution. variable constant function integer

Boolean

A ________________ value is a value of true and false. Switch Null Constant Boolean

Inner join

A join that returns records from related tables only if their related fields match is called an outer join an inner join a cross join a data join

A client and a server

A request and response for a file are made by a) a client and a server b) a browser and an application c) a client and an agent d) the Web page

Client/server application

A web application is a type of

a client sends an HTTP request to a server

A web application starts when

Exception

A/An ________________ is an object that contains information about an error. exception PDO class MySQL database username

2

After the code that follows is executed, what will the value of $units_per_store be?$units = 30;$stores = 4;$units_per_store = $units % $stores; 7 7.5 2 0

All of these

An advantage of using MySQL is: cost speed ease of use all of these

If the primary key and foreign key are equal

An inner join combines data from two or more tables if the primary key and foreign key are equal if the primary key and foreign key aren't equal if the primary keys in each table are equal if the primary keys in each aren't equal

Primary key

Each row in a table should be able to be uniquely identified by a: primary key field name cell record

A web browser

Google chrome is

six

How many data types are used by PHP? six nine eleven twelve

0

How many times will the while loop that follows be executed?$months = 5;$i = 1;while ($i > $months) {$futureValue = $futureValue * (1 + $monthlyInterestRate);$i = $i+1;}

6

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

A list of all the directories in that directory

If a URL specifies a directory that doesn't contain a default page, Apache displays a) a list of all of the directories in that directory b) a list of all of the web applications in that directory c) a list of the PHP applications in that directory d) an error message

One-to-one relationship

If a row in one table is related to just one row in another table, the tables are said to have a one-to-many relationship one-to-one relationship many-to-many relationship

$

In PHP, all variables begin with a: $ & lowercase letter uppercase letter


Kaugnay na mga set ng pag-aaral

Sensory Physiology Questions for Practice

View Set

Intermediate MC Quiz Study guide

View Set

VN105 CH7 The Skeletal System: Bones and Joints

View Set

Chapter 16 & 17 reading - Genetics

View Set

Chapter 20 - Accounting Changes/Estimates/Errors

View Set

Interpersonal Communication exam 1

View Set