Practice Tests – Flashcards
Unlock all answers in this set
Unlock answersquestion
If you use a variable name in a text string enclosed by single quotation marks, the name of the variable will display.
answer
True
question
In PHP programming, you can only use TRUE or FALSE to indicate Boolean values.
answer
True
question
The values assigned to different array elements of the same array can be of different data types.
answer
True
question
A function definition contains the lines of code that make up a function.
answer
True
question
A function must contain a parameter.
answer
False
question
A function executes automatically.
answer
False
question
A return statement is a statement that returns a value to the statement that called the function.
answer
True
question
In PHP, you must declare a global variable with the global keyword inside a function definition for the variable to be available within the scope of that function.
answer
True
question
You will not receive an error if you attempt to use a foreach statement with any variable types other than arrays.
answer
False
question
The include statement and the require statement perform the same function and can be used interchangeably.
answer
False
question
____ are lines you place in your code that do not get executed but provide helpful information such as the name of the script, your name and the date your created the program.
answer
Comments
question
____ a variable is the processing of assigning a first value to a variable.
answer
Initializing
question
The ____ function is used to create a constant.
answer
define()
question
The ____ type is the specific category of information that a variable contains.
answer
data
question
Data types that can be assigned only a single value are called ____ types.
answer
primitive
question
In a ____ programming language the data type for a variable will not change after it has been declared.
answer
strongly typed
question
____ are positive and negative numbers and 0 with no decimal places.
answer
Integers
question
Exponential ____ is a shortened format for writing very large numbers with any decimal places.
answer
notation
question
A(n) ____ is an element's numeric position within an array.
answer
index
question
You use the ____ function to find the total number of elements in an array.
answer
count()
question
The print_r(), var_export(), and var_dump()functions are used with ____ to display the index and value of each element.
answer
arrays
question
A(n) ____ is a literal value or variable that can be evaluated by the PHP scripting engine to produce a result.
answer
expression
question
____ are symbols, such as the (+) symbol that are used in expressions to manipulate operands.
answer
Operators
question
A(n) ____ operator requires a single operand either before or after the operator.
answer
unary
question
A(n) ____ operator is used in PHP to perform mathematical calculations.
answer
arithmetic
question
The ____ operator uses the % symbol to find the remainder of integer division.
answer
modulus
question
Assignment operators are used to assign a ____ to a variable.
answer
value
question
____ assignment operators perform mathematical calculations on variables and literal values in an expression and then assign a new value to the left operand.
answer
Compound
question
The ____ operation uses the === (triple equal sign) to compare two operands for equality and data type.
answer
strict equal
question
The ____ operator executes one of two expressions based on the results of a conditional expression.
answer
conditional
question
Logical operators are used for comparing two ____ operands for equality.
answer
Boolean
question
The ____ symbol is used to suppress any errors that might be generated by an expression to which it is prepended.
answer
@
question
One way to ensure that a variable is of the correct data type is through type ____.
answer
casting
question
The ____ function tests whether a variable contains a numeric data type.
answer
is_numeric()
question
When you use a variable in a PHP program, you must be aware of the variable's ____.
answer
scope
question
A variable's scope can be either global or ____.
answer
local
question
What will be returned if you use a local variable outside the function in which it is declared?
answer
error message
question
The parameters within the parentheses of a function declaration are what kind of variables?
answer
local
question
With many programming languages, global variables are automatically available to all parts of your program, including ____.
answer
functions
question
When you declare a global variable with the global keyword, you do not need to assign the variable a(n) ____.
answer
value
question
A command block is a group of statements within a set of opening and closing ____.
answer
braces
question
When one decision-making statement is contained within another decision-making statement it is referred to as a ____ decision-making structure.
answer
nested
question
Which of the following terms is not associated with the switch statement?
answer
switch title
question
A(n) ____ statement is a control structure that repeatedly executes a statement or series of statements while a specific condition is TRUE or until a specific condition becomes TRUE.
answer
loop
question
A ____ is a variable that increments or decrements with each iteration of a loop statement
answer
counter
question
If you do not include code that changes the value used the by the condition expression, your program will be caught in a ____ loop.
answer
infinite
question
A ____ statement is used to iterate or loop through the elements in an array.
answer
foreach
question
The ____ statement halts the processing of the web page and displays an error if an include file cannot be found.
answer
require
question
The ____ file is typically saved with a prefix of inc_.
answer
include
question
The concatenation operator in PHP is a ____.
answer
period (.)
question
In PHP, the escape character is the ____.
answer
backslash()
question
The escape character sequence ____ inserts a new line.
answer
n
question
The escape sequence inserts a(n) ____.
answer
backslash
question
The escape sequence to insert a carriage return is ____.
answer
r
question
A structure in which variables are placed within curly braces inside of a string is called a ____.
answer
complex string syntax
question
The strlen() function returns the total ____ in a string.
answer
number of characters
question
The ____ function converts all of the letters in a string to capital letters.
answer
strtoupper()
question
The ____ function converts any occurrence of (;), ("), ('), () to their equivalent HTML character entity.
answer
htmlspecialchars()
question
The ____ function will remove both leading and trailing spaces from a string.
answer
trim()
question
The ____ function randomly scrambles the order of characters in a string.
answer
str_shuffle()
question
The ____ function splits a string into an indexed array.
answer
explode()
question
ASCII values range from ____.
answer
0 to 255
question
The similar_text() function returns the number of ____ to strings have in common.
answer
characters
question
In a regular expression, a(n) ____ specifies that the pattern must appear at that position in the string.
answer
anchor
question
The ____ quantifier specifies that zero or more of the preceding characters can match.
answer
(*)
question
____ quantifiers allow you to more precisely specify the number of times a character must repeat sequentially.
answer
Curly brace
question
The characters contained in a set of parentheses within a regular expression are referred as a ____.
answer
subpattern
question
The ____ metacharacter is used to specify a range of values in a character class.
answer
(-)
question
The ____ metacharacter is used to allow a string to contain an alternate set of substrings.
answer
(|)
question
Autoglobals or superglobals are predefined ____.
answer
arrays
question
Autoglobals are associative arrays whose elements are referred to with a(n) ____ key instead of an index number.
answer
alphanumeric
question
You can use ____ autoglobal array to refer to the global version of a variable from inside a function.
answer
$GLOBALS
question
The value of the ____ attribute identifies the program on the Web server that will process the form data when the form is submitted.
answer
action
question
When you use the ____ method to submit form data to the processing script, the form data is appended to the URL specified by the action attribute.
answer
get
question
The PHP feature that automatically adds a backslash to any single quote, double quote, or NULL character contained in form data that a user submits to a PHP script is ____.
answer
magic quotes
question
The ____ function is used to reverse the changes made by magic quotes or the addslashes() function.
answer
stripslashes()
question
The ____ function can be used to ensure that a number has the appropriate number of decimal places.
answer
round()
question
In PHP, a(n) e-mail message is sent using the ____ function.
answer
mail()
question
A ____ form contains one page that displays the Web form and one page that process the form data.
answer
two-part
question
A Web page ____ is a single Web page that is divided into sections
answer
template
question
PHP scripts that are included in a Web template often begin with a prefix of ____.
answer
inc
question
If the content of a Web page template section does not change unless the include file is modified, it is called a ____ section.
answer
static
question
The ____ autoglobal can be used to access the result from form data sent with both the get and post methods.
answer
$_REQUEST
question
On a Macintosh platform, you append the ____ carriage return escape sequence to the end of the line.
answer
r
question
The second digit in the file permission code assigns permissions to the ____.
answer
user
question
The ____ function returns an indexed array containing the names of files and directories in the specified directory.
answer
scandir()
question
When a form is posted, information from the uploaded file is stored in the ____ autoglobal array.
answer
$_FILES[]
question
The ____ function writes a text string and creates the file if it does not exist.
answer
file_put_contents()
question
When a text file contains a single block of text, the ____ function would read the entire contents of the file into a string.
answer
file_get_contents()
question
When you are finished working with a file stream, you use the ____ function to ensure that the file does not keep taking up space in your computer's memory.
answer
fclose()
question
The ____ argument of the fwrite() function allows you to specify the maximum number of bytes that should be written.
answer
length
question
The operational constant of the flock() function that opens the file with an exclusive lock for writing is the ____.
answer
LOCK_EX
question
Instead of reading a large text file into PHP, you can use the ____ to iterate through a text file.
answer
file pointer
question
Every time you use the ____ function, the file pointer moves to the next character in the file.
answer
fgetc()
question
What function returns a line and moves the file pointer to the next line?
answer
fgets($handle[, length])
question
What function returns a line, strips any XHTML tags the line contains, and then moves the file pointer to the next line?
answer
fgetss($handle, length[, allowed_tags])
question
With the exception of the ____ function, each time you call a function that iterates through a text file, the file pointer automatically moves to the next line in the text file.
answer
fgetc()
question
The ____ function should be used before deleting files and directories to determine if the file or directory name exists.
answer
file_exists()
question
What function is used to copy the names of the files in a directory to an array?
answer
scandir()
question
To summarize data in a set of records, you use a family of functions called ____ functions.
answer
aggregate
question
You use the ____ function to return a portion of an array and assign it to another array.
answer
array_slice()
question
You use the ___ statement to retrieve records from a table.
answer
SELECT
question
Almost every command sent to MySQL from PHP is executed with the ____ function.
answer
mysql_query()
question
To delete a database, you must execute the ____ DATABASE command.
answer
DROP
question
To sort an associative array by key, use the ____ function.
answer
ksort()
question
When inserting a new record in a table, you must specify the keyword(s) ____ for any fields in which you do not have a value.
answer
NULL
question
You select a database or change to a different database with the ____ function.
answer
mysql_select_db()
question
The ____ statement is used to take away privileges from an existing user account for a specified table or database.
answer
REVOKE
question
The ____ function determines whether a given index or key exists.
answer
array_key_exists()
question
Merge two or more arrays with the ____ function.
answer
array_merge()
question
To renumber an indexed array's elements, you need to run the ____ function.
answer
array_values()
question
The symbol ____ appends one array to another.
answer
+
question
To close a database connection, use ____.
answer
mysql_close()
question
phpMyAdmin provides a convenient method of transferring files from the development server to the production server using the _____ process.
answer
export/import
question
The array_shift() function removes the ____ element from the beginning of an array.
answer
first
question
The ___ keyword, often used with the primary key, requires that the field include a value.
answer
NOT NULL
question
The list of records that is returned from a mysql_query() is a called a ____.
answer
resultset
question
By default, field values in an external text file that are being inserted in a table are separated by the ____ keyboard character.
answer
tab
question
You can create ____ that consist of multiple indexes or keys.
answer
multidimensional arrays
question
The most common type of multidimensional array is a(n) ____ array.
answer
two-dimensional
question
The function ____ returns the fields in the current row into an indexed array.
answer
mysql_fetch_row()
question
To add multiple records to a database from an external file, you use the ____ statement with the name of the local text file that contains the records you want to add.
answer
LOAD DATA
question
To delete records in a table, use the keywords ____.
answer
DELETE, WHERE
question
To store text in a field, you specify a data type of ____ because the amount of storage space allocated will depend on the number of characters in the field.
answer
VARCHAR
question
To remove a column from an existing table, use the ___ keyword with the ALTER TABLE statement.
answer
DROP
question
The symbol (@), used to suppress error messages, is called ____.
answer
error control operator
question
The ____ function removes duplicate elements from an array.
answer
array_unique()
question
Use the ___ function to return the number of fields in a query result.
answer
mysql_num_fields()
question
To perform a reverse sort on an associative array by key and maintain the existing keys, use the _____ function.
answer
krsort()
question
To open a connection to a MySQL database server, use ____.
answer
mysql_connect()
question
The array_pop() function ____ from the end of the array.
answer
removes the last element
question
You can arrange query results from a SELECT statement using the keyword(s) ____.
answer
ORDER BY
question
____ reduces the size of a database and makes the data easier to work with.
answer
Normalization
question
To make a specific database active, you must execute the ____ database statement.
answer
USE
question
The ____ function returns an array of elements that exist in one array but not in any other arrays to which it is compared.
answer
array_diff()
question
Using the COUNT() aggregate function, you can eliminate duplicate values by using the keyword(s) ____.
answer
DISTINCT
question
To close the resultset, use ____.
answer
mysql_free_result()
question
The ____ argument of the array_splice() function indicates the name of the array you want to modify.
answer
array_name
question
The ____ command with a mysql_query() function executes successfully if the table already exists.
answer
SHOW TABLES LIKE
question
To remove multiple elements using the unset() function, separate each ____ name with commas.
answer
element
question
The data values for input elements that use array notation for the value of the name attribute are stored in a ____ array within the $_POST autoglobal array.
answer
nested
question
To change records in a table, use the UPDATE keyword to specify the name of the table to update and the ___ keyword to specify the value to assign to the fields in the records that match the condition in the WHERE keyword.
answer
SET
question
The function ____ returns the fields in the current row of a resultset into an associative array and moves the result pointer to the next row.
answer
mysql_fetch_assoc()
question
Multidimensional arrays are not limited to ____.
answer
two dimensions
question
The ____ keyword specifies the name of the table that needs to be modified when updating records.
answer
UPDATE
question
The ___ keyword is used with the ALTER TABLE statement to rename a table.
answer
RENAME
question
To delete a database, use the ____ function.
answer
mysql_drop_db()
question
What privilege allows the user to select records?
answer
SELECT