Quiz 2: Functions and Control Structures
Computing
Free
True False
True
Free
True False
False
Free
True False
False
Q 4Q 4
Function arguments are the statements that do the actual work of the function and must be contained within the function braces.
Free
True False
Free
True False
Free
True False
Q 7Q 7
A return statement is a statement that returns a value to the statement that called the function.
Free
True False
Free
True False
Free
True False
Q 10Q 10
If you attempt to use a local variable outside the function in which it is declared, you receive an error message.
Free
True False
Q 11Q 11
The formal parameters within the parentheses of a function declaration are global variables.
Free
True False
Q 12Q 12
Global variables are automatically available to all parts of your program, including functions.
Free
True False
Q 13Q 13
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.
Free
True False
Free
True False
Free
True False
Free
True False
Q 17Q 17
When one decision-making statement is contained within another decision-making statement, they are referred to as multiple decision-making structures.
Free
True False
Q 18Q 18
The switch statement controls program flow by executing a specific set of statements, depending on the value of an expression.
Free
True False
Q 19Q 19
The default label contains statements that execute when the value returned by the switch statement expression does not match any case label.
Free
True False
Q 20Q 20
To ensure that the while statement will eventually end, you must include code within the body of the while statement that changes the value of the conditional expression.
Free
True False
Q 21Q 21
You can use the terminate statement to halt a looping statement and restart the loop with a new iteration.
Free
True False
Q 22Q 22
The do...while statement executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Free
True False
Q 23Q 23
The statements in a do...while statement always execute repeatedly before the conditional expression evaluates the count variable.
Free
True False
Free
True False
Q 25Q 25
One of the primary differences between the while statement and the for statement is that in addition to a conditional expression, the for statement can also include code that initializes a counter and changes its value with each iteration.
Free
True False
Free
True False
Q 27Q 27
You will not receive an error if you attempt to use a foreach statement with any variable types other than arrays.
Free
True False
Q 28Q 28
The primary use of the include and require statements is to reuse content on multiple web pages by allowing you to insert the content of an external file, called an include file, in your PHP scripts.
Free
True False
Q 29Q 29
The include statement and the require statement perform the same function and can be used interchangeably.
Free
True False
Free
True False
Q 31Q 31
When you use a variable in a PHP program, you must be aware of the variable's ____.
A) placement
B) scope
C) function
D) statement
Free
Multiple Choice
Q 32Q 32
A variable's scope can be either global or ____.
A) local
B) undeclared
C) universal
D) declared
Free
Multiple Choice
Q 33Q 33
What will be returned if you use a local variable outside the function in which it is declared?
A) value
B) error message
C) function
D) nothing
Free
Multiple Choice
Q 34Q 34
The parameters within the parentheses of a function declaration are what kind of variables?
A) local
B) global
C) unknown
D) declared
Free
Multiple Choice
Q 35Q 35
With many programming languages, global variables are automatically available to all parts of your program, including ____.
A) statements
B) definitions
C) functions
D) declarations
Free
Multiple Choice
Q 36Q 36
When you declare a global variable with the global keyword, you do not need to assign the variable a(n) ____.
A) value
B) definition
C) function
D) name
Free
Multiple Choice
Q 37Q 37
A command block is a group of statements within a set of opening and closing ____.
A) brackets
B) braces
C) parentheses
D) quotation marks
Free
Multiple Choice
Q 38Q 38
When one decision-making statement is contained within another decision-making statement it is referred to as a ____ decision-making structure.
A) enclosed
B) contained
C) nested
D) layered
Free
Multiple Choice
Q 39Q 39
Which of the following terms is not associated with the switch statement?
A) switch title
B) case label
C) executable statements
D) break keyword
Free
Multiple Choice
Q 40Q 40
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.
A) repeat
B) replicate
C) loop
D) circular
Free
Multiple Choice
Q 41Q 41
A ____ is a variable that increments or decrements with each iteration of a loop statement
A) counter
B) incrementer/decrementer
C) iterator
D) repetitor
Free
Multiple Choice
Q 42Q 42
If you do not include code that changes the value used the by the condition expression, your program will be caught in a ____ loop.
A) continuous
B) continuing
C) constant
D) infinite
Free
Multiple Choice
Q 43Q 43
A ____ statement is used to iterate or loop through the elements in an array.
A) for
B) while
C) foreach
D) if...else
Free
Multiple Choice
Q 44Q 44
The ____ statement halts the processing of the web page and displays an error if an include file cannot be found.
A) include
B) insert
C) Insert-contents
D) require
Free
Multiple Choice
Q 45Q 45
The ____ file is typically saved with a prefix of inc_.
A) insert
B) include
C) nested
D) increment
Free
Multiple Choice
Free
Short Answer
Q 47Q 47
____________________-control statements allow you to determine the order in which statements execute in a program.
Free
Short Answer
Free
Short Answer
Free
Short Answer
Free
Short Answer
Q 51Q 51
A ____________________ statement is a statement that returns a value to the statement that called the function.
Free
Short Answer
Q 52Q 52
Passing by ____________________ means that the actual variable is used within the function and any changes made to the variable by the function will remain after the function completes.
Free
Short Answer
Q 53Q 53
A ____________________ variable is declared outside a function and is available to all parts of the program.
Free
Short Answer
Q 54Q 54
A ____________________ variable is declared inside a function and is only available within the function in which it is declared.
Free
Short Answer
Q 55Q 55
You must use the ____________________ keyword to declare a global variable within the scope of a function.
Free
Short Answer
Q 56Q 56
The ____________________ statement is used to execute specific programming code if the evaluation of a conditional expression returns a value of true.
Free
Short Answer
Q 57Q 57
A(n) ____________________ block is a group of statements contained within a set of braces, similar to the way function statements are contained within a set of braces
Free
Short Answer
Free
Short Answer
Q 59Q 59
When one decision-making statement is contained within another decision-making statement, they are called ____________________ decision-making structures.
Free
Short Answer
Q 60Q 60
____________________ are added to both the if and else portions of the if...else statement if a section contains more than one statement.
Free
Short Answer
Q 61Q 61
The ____________________ statement controls program flow using a case statement that executing a specific set of statements, depending on the value of an expression.
Free
Short Answer
Q 62Q 62
The switch statement compares the value of an expression to a value contained within a special statement called a ____________________.
Free
Short Answer
Q 63Q 63
A switch statement contains the following components: the keyword switch, an expression, an opening brace, a case label, the executable statements, the keyword ____________________, a default label, and a closing brace.
Free
Short Answer
Q 64Q 64
case $ExampleVar is an example of a ____________________ data type being used as a case label
Free
Short Answer
Free
Short Answer
Free
Short Answer
Free
Short Answer
Q 68Q 68
The ____________________ label contains statements that execute when the value returned by the switch statement expression does not match a case label.
Free
Short Answer
Q 69Q 69
The final ____________________ statement after the final case or default statement is not required.
Free
Short Answer
Q 70Q 70
A(n) ____________________ statement is a control structure that repeatedly executes a statement or a series of statements while a specific condition is TRUE or until a specific condition becomes TRUE.
Free
Short Answer
Q 71Q 71
The ____________________ statement repeats a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Free
Short Answer
Q 72Q 72
The conditional expression in the while statement is enclosed within ____________________ following the keyword while.
Free
Short Answer
Free
Short Answer
Q 74Q 74
A ____________________ statement keeps repeating until its conditional expression evaluates to FALSE.
Free
Short Answer
Q 75Q 75
A ____________________ is a variable that increments or decrements with each iteration of a loop statement.
Free
Short Answer
Q 76Q 76
In a(n) ____________________ loop, a loop statement never ends because its conditional expression is never FALSE.
Free
Short Answer
Q 77Q 77
The ____________________ loop executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Free
Short Answer
Q 78Q 78
The ____________________ statement is used for repeating a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Free
Short Answer
Free
Short Answer
Q 80Q 80
The ____________________ statement is used to iterate or loop through the elements in an array.
Free
Short Answer
Q 81Q 81
In a foreach statement, you use the $variable_name ____________________ to access the value of the element that is available in an iteration.
Free
Short Answer
Free
Short Answer
Q 83Q 83
With the ____________________ statement the program assure that the file is added to the script only once and halts the processing of the web page and displays an error message if the include file cannot be found.
Free
Short Answer