quiz 9, quiz 8, quiz 7, quiz 6, Quiz 5, Quiz 4, quiz 3, Quiz 2, QUIZ 1
which of the following is not a compound assignment operator in PHP?
!=
Which of the following can be used to style a label in an id named data?
#data label
in PHP, all variables begin with a:
$
which character is used to separate parameters that are appended to a URL?
$
Assume that the POST method is used. Which of the following statements gets the value of the radio button that's on in the delivery group and stores it in a variable named $card_type?<input type="radio" name="delivery" value="USPS">USPS<input type="radio" name="delivery" value="FedEx">Federal Express <input type="radio" name="delivery" value="UPS">UPS
$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);
Which character is used to separate parameters that are appended to a URL?
&
What extension of a filename is typically associated with a static Web page?
.htm
which of the following is NOT an escape sequence used in double-quoted strings in PHP? /n /t /c /r
/c
How many times will the while loop that follows be executed? $months = 5; $i = 1; while ($i > $months) { $futureValue = $futureValue * (1 + $monthlyInterestRate);
0
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 ) { $message = $months . " months"; } else if ( $months == 0 ) { $message = $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; for ( $i = 1; $i <= $years; $i++ ) { $future_value = $future_value * (1 + $annual_rate); }
1100
What does $shipping_cost contain after the following code executes? $quantity = 3; $shipping_cost = ($quantity > 1) ? 5 + ($quantity * 2.5) : 5;
12.5
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;
2
how many radio buttons from the following code can be selected at any given time <input type="radio" name="address" value="Home">Home Address<input type="radio" name="delivery" value="FedEx">Federal Express <input type="radio" name="delivery" value="UPS">UPS
2
How many operands does a ternary operator have?
3
After the if statement that follows is executed, what will the value of $discount_amount be? $discount_amount; $order_total = 200; if ($order_total > 200) { $discount_amount = $order_total * .3; } else if ($order_total > 100) { $discount_amount = $order_total * .2; } else { $discount_amount = $order_total * .1; }
40
If a PHP array contains 7 elements, what is the number of the index of the seventh element?
6
After the code that follows is executed, what will the value of $units_per_store be? $units = 30; $stores = 4; $units_per_store = intdiv($units, $stores);
7
which of the following is considered the assignment operator in PHP?
=
which of the following operators does NOT perform type coercion
===
which character is used to separate the original URL from the parameters that are appended to it?
?
Which of the following is software that is a Web server?
Apache
a _____________ value is a value of true and 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 clause in a SQL statement specifies the table(s) that should supply the data that is returned?
FROM
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
What type of a request does a Web browser typically send to a server?
HTTP
Which of the following is NOT a common MySQL privilege?
INSERT TABLE
Which clause in a SQL statement is typically used to return data from more than one table?
JOIN
What does $message contain after the following code executes? $statusCode = "403"; switch ( $statusCode ) { case "200": $message = "OK"; break; case "403": $message = "Forbidden"; break; case "404": $message = "Not Found"; break; default: $message = "Unknown Status"; break; }
L: 0, 1, 2, 3, 4, 5, 6, 7,
Which of the following is NOT true about MariaDB?
Like MySQL, it is owned by Oracle.
what does the acronym MVC stand for
Model View Controller
assigning __________ to a variable indicated the variable does not contain a usable value
NULL
Which clause in a SQL statement specifies how the result set should be sorted?
ORDER BY
which PHP class can be used to connect to a MySQL database?
PDO
which of the following is a class used for errors thrown by the PDO library? PDOException PDOCatch PDOHandler CatchExpression
PDOException
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
PDOException object
Which of the following software components generates the HTML that is returned in an HTTP response?
PHP
which method of the form passes data without appending the parameters to the URL?
POST
Which of the following is not a database server that can be used for dynamic Web pages?
Python
Which clause in a SQL statement specifies the columns to return?
SELECT
Which type of SQL statement returns a result set?
SELECT
URL stands for
Uniform Resource Locator
which clause in a SQL statement specifies the records to return based on criteria
WHERE
A request and response for a file are made by
a client and a server
If a URL specifies a directory that doesn't contain a default page, Apache displays
a list of all the directories in that directory
when you use the header() function to redirect a request
a response is returned to the browser that tells it to request another page
Which of the following can be displayed if you omit the filename of a URL? index.htm index.html index.php all of these
all of these
an advantage of using MySQL is: cost speed ease of use all of these
all of these
which of the following can be used in a conditional expression equality operations relational operators logical operators all of these
all of these
which of the following is a relational operator in PHP? < <= > all of these
all of these
which of the following is a way to assign a string to a variable in PHP? single quotes double quotes heredoc all of these
all of these
a join that returns records from related tables only if their related fields match is called an
an inner join
____________ are used in PHP to perform mathematical calculations, such as addition
arithmetic operators
in HTML, parameters are called
attributes
To make it easier to enter names into your code, NetBeans provides a feature known as
auto-completion
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()
a _____ statement can be used to jump out of a loop
break
which type of statement ends or jumps out of a loop
break
when debugging an application, you can set a ___________ to view the value of a variable at a particular point
breakpoint
an index for a PHP array:
can be a number or a string
which type of input element should be used on a form when the user can select zero, one, or many of the options in a group?
checkbox
A web application is a type of A. client/server application b. database application c. client-side application d. server-side application
client/server application
a ___________ contains a value that does not change during the course of program execution
constant
which of the following statements will restart the execution of a loop?
continue
which type of statement ends the current iteration of a loop?
continue
In the code that follows, if $error_message isn't empty if ($error_message != ' '){ include('index.php'); exit(); }
control is passed to a page named index.php that's in the current directory
a switch statement in PHP is often useful in the __________ of an application that uses the MVC pattern
controller
which of the following receives requests from users, gets the appropriate data, and returns that appropriate views to the users? controller view finder model verifier
controller
which of the following can a SELECT statement NOT do to the data in a table?
delete the rows
when you use htmlspecialchars() and nl2rb() functions to process a user's entry and then pass that entry to a web page, the browser will
display any HTML tags entered by the user instead of processing them
which type of loop will always execute its code at least once?
do-while
a hidden field
doesn't appear on the form but its data is sent to the server
To print a variable with the echo statement, you simply pass the variable name to the echo statement. For example:
echo $VotingAge;
What does $salutation contain after the following code executes? $company_name = ''; $salutation = $company_name ?? 'To whom it may concern';
empty string (")
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
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? catch exception handler block
exception
a switch statement in PHP starts by evaluating a switch ___________
expression
which of the following is a method of the PDOStatement class that returns an array for the next row in a result set? fetch() sit() getArray() getRow()
fetch()
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
what is the goal of debugging an application before it is put into production?
fix all errors
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
foreach statement
what does a relational database use to relate to the tables in a database to other tables
foreign keys
When you ________________ a request, all processing takes place on the server.
forward
The HTTP response for a dynamic web page is passed
from the web server to the browser
to make a variable that is declared outside of a function usable inside the PHP function, which keyword can be used
global
which function can be used to redirect a request to another URL?
header()
which PHP function returns a string with all special HTML converted to the HTML entity?
htmlentities()
which PHP function converts some special characters into character entities?
htmlspecialchars()
Which URL can be used to start phpMyAdmin on a local system?
http://localhost/phpmyadmin
which function can be used to forward a request from one PHP file to another?
include()
The order of precedence for arithmetic expressions causes
increment operations to be done first
a(n) _________ is a positive or negative number with no decimal places
integer
Variable substitution is carried out by what process that converts a variable's value to a string?
interpolation
When double quotes are used to assign values to string variables, the PHP interpreter must check the entire string to see if it contains any variables that need to be inserted into the string. This process is called:
interpolation
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 PHP function can be used to determine if a checkbox is checked?
isset()
while loops and for loops are often referred to as ___________ structures
iteration
the ________ of a string specifies the number of characters that it contains
length
Which HTML tag or element is used to load an external stylesheet
link
which type of error is often the most difficult to find and fix?
logic
An error that lets the application run but produces the wrong results is known as a
logic error
____________ operators are used for combining conditional expressions
logical
When you use the MVC pattern, you
make each layer as independent as possible
the ___________ function returns the largest value of two or more arguments that are passed to it
max
which attribute of a form element determines how the data is passed to a file?
method
which of the following consists of the PHP files that represent the data of the applications? controller model inheriter requester
model
the _________ operator divides one operand and returns the remainder
modulus
which optional attribute of a select element allows the user to select more than one option in a list box?
multiple
which of these would NOT be considered a common syntax error in PHP? misspelling keywords forgetting to end a statement with a semicolon forgetting a closing quotation mark multiplying by the wrong variable
multiplying the wrong variable
In order to group multiple radio buttons so that only one of the radio buttons can be selected at a time, which attribute of the input element must have the same value for all radio buttons in the group?
name
which keyword is used to create an object from a class in PHP?
new
which of the following is NOT part of an HTTP URL
node
if a row in one table is related to just one row in another table, the tables are said to have a
one-to-one relationship
which HTML element is used to create items in a drop-down list?
option
when creating a function, ____________ can be included in the parentheses that follow the name
parameters
what is the concatenation operator in PHP?
period
When the web server receives an HTTP request for a PHP page, the web server calls the A. database server B. static web page C. web browser D. PHP interpreter
php interpreter
each row in a table should be able to be uniquely identified by a:
primary key
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
a "natural" comparison of two values
puts both "09" and "9" before "10"
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 functions should you use to get a random number if security is a concern?
random_int()
When you ________________ a request, the server returns a response that tells the browser to request another URL.
redirect
which of the following is a term that refers to modifying the organization or structure of an application? interpolation refactoring instantiation inheritance
refactoring
If many different files may load an external file, what statement can be used instead of 'include' to make sure the external file is only loaded once?
require_once
which type of statement should be included if the function should send a value back to where the function was called?
return
To view the source code for a web page in a web browser, you can display the View Source command by
right-clicking on the page
If you want to round a number within an arithmetic expression, which function should you use?
roundI()
A table in a relational database consists of columns and ________________.
rows
when you click on the continue button while youre debugging with NetBeans, the application
runs to the next breakpoint
which type of error does not violate the rules for how PHP statements must be written but 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 a
runtime error
which HTML element is used to create a drop-down list?
select
an if statement can be used to implement a ____________ structure
selection
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
server name
How many data types are used by PHP?
six
which of the following lists the functions in the reverse order in which they were called? stack trace breakpoint called collection IntelliSense
stack trace
When HTML was first developed, Web pages were typically
static
Which PHP function returns the number of characters in a string?
strlen()
which type of error is considered the easiest to find?
syntax
which type of error is considered the easiest to fix?
syntax
When you test an application with NetBeans and a breakpoint is reached, you can click
the Step Into button to execute the current statement and move to the next statement
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 patter, the controller gets the HTTP requests and then directs the use of the files that represent
the model and the view
When you use the substr() function to extract a substring from a string, you need to at least pass an argument that gives
the starting position of the substring
to handle exceptions, first you code a ______ around any PHP statements that might throw an exception
try block
The result set retrieved by the following SELECT statement contains rows that have SELECT balance, number FROM accounts WHERE balance < 0
two of the columns from the accounts table where balance is less than 0
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
which of the following consists of the PHP and HTML files that represent the user interface of an application? logic model view classes
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