Docsity

CIST2351-PHP Programming I - Midterm Prep rated A.pdf, Exams of Nursing

Toggle sidebar
bg1
CIST2351-PHP Programming I - Midterm
Prep rated A
Midterm Prep
CIST2351-PHP Programming I - correct answer
✅
A hidden field: - correct answer
✅
doesn't appear on the form but its data is sent
to the server
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? - correct answer
✅
$card_type = filter_input(INPUT_POST,
'delivery');
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); - correct answer
✅
With
character entities for special characters
Which attribute of a form element determines how the data is passed to a file? -
correct answer
✅
method
Which optional attribute of a select element allows the user to select more than
one option in a list box? - correct answer
✅
multiple
Which method of the form appends values to the URL to pass data? - correct
answer
✅
GET
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CIST2351-PHP Programming I - Midterm Prep rated A.pdf and more Exams Nursing in PDF only on Docsity!

Prep rated A

Midterm Prep CIST2351-PHP Programming I - correct answer ✅ A hidden field: - correct answer ✅doesn't appear on the form but its data is sent to the server 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? - correct answer ✅$card_type = filter_input(INPUT_POST, 'delivery'); 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); - correct answer ✅With character entities for special characters Which attribute of a form element determines how the data is passed to a file? - correct answer ✅method Which optional attribute of a select element allows the user to select more than one option in a list box? - correct answer ✅multiple Which method of the form appends values to the URL to pass data? - correct answer ✅GET

Prep rated A

Which PHP function convert some special characters into character entities? - correct answer ✅htmlspecialchars Which character is used to separate the original URL from the parameters that are appended to it? - correct answer ✅? Which type of input element should be used on a form when the user can select only one of the options? - correct answer ✅radio Which HTML element is used to create a drop-down list? - correct answer ✅select The goal of testing is to - correct answer ✅find all errors in the application The type of error that does not violate syntax rules, but causes the PHP interpreter to display errors is called - correct answer ✅runtime error Which type of error does not cause the PHP interpreter to display errors, but may produce incorrect output? - correct answer ✅logic Which of the following lists the functions in the reverse order in which they were called? - correct answer ✅stack trace Which type of error is often the most difficult to find and fix? - correct answer ✅logic

Prep rated A

Which of the following is a term that refers to modifying the organization or structure of an application? - correct answer ✅refactoring What does the acronym MVC stand for? - correct answer ✅Module-View- Controller Which function can be used to forward a request from one PHP file to another? - correct answer ✅include Which of the following consists of the PHP and HTML files that represent the user interface of the application? - correct answer ✅view When creating a function, _____ can be included in the parentheses that follow the name. - correct answer ✅parameters Which function can be used to redirect a request to another URL? - correct answer ✅header A/An _____ is an object that contains information about an error. - correct answer ✅exception To handle exceptions, first you code a/an _____ around any PHP statements that might throw an exception> - correct answer ✅try block

Prep rated A

The _____ for a MySQL connection specifies the host computer for the MySQL database and the name of the database. - correct answer ✅DSN (Data Source Name) Which of the following can be used to get the data from an array that contains all rows of a result set? - correct answer ✅foreach statement 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 - correct answer ✅bindValue Which keyword is used to create an object from a class in PHP? - correct answer ✅new Which of the following is a class used for errors thrown by the PDO library? - correct answer ✅PDIException If a PHP array contains 7 elements, what is the number of the index of the seventh element? - correct answer ✅ 6 Which PHP class can be used to connect to a MySQL database? - correct answer ✅PDO Which of the following is an object that contains information about an error that occurred? - correct answer ✅exception

Prep rated A

ON vendors .vendorID = invoices.vendorID WHERE invoiceTotal >= 500 ORDER BY vendorName DESC What table(s) does the data in the result set come from? - correct answer ✅vendors and invoices CODE EXAMPLE 3- 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? - correct answer ✅alphabetically starting with Z When you code a DELETE statement, you usually need to include: - correct answer ✅a WHERE clause What type of SQL statement is used to assign user privileges in MySQL? - correct answer ✅GRANT

Prep rated A

Which of the following is NOT a common MySQL privilege? - correct answer ✅Insert TABLE Which of the following is NOT a common MySQL data type? - correct answer ✅DBL A web application is a type of _____. - correct answer ✅client/server application The HTTP response for a dynamic web page is passed - correct answer ✅from the web server to the browser To deploy a PHP application on your own computer, you copy the application root directory to - correct answer ✅the htdocs directory of the Apache server 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 - correct answer ✅uses localhost as the domain name The first part of a URL is called the - correct answer ✅protocol When HTML was first developed, Web pages were typically - correct answer ✅static Which of the following is NOT a database server that can be used for dynamic Web pages? - correct answer ✅Python

Prep rated A

$message = $years. "years, and ". $months. " months"; } - correct answer ✅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); } - correct answer ✅ 1100 A(n) _____ is a positive or negative number with no decimal places. - correct answer ✅integer How many data types are used by PHP? - correct answer ✅six A _____ value is a value of true or false. - correct answer ✅Boolean _____ are used in PHP to perform mathematical calculations, such as addition. - correct answer ✅Arithmetic operators A _____ contains a value that does not change during the course of program execution. - correct answer ✅constant

Prep rated A

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. - correct answer ✅equal