Deck 2: Functions and Control Structures

Full screen (f)
exit full mode
Question
Like variables, function names are case sensitive.
Use Space or
up arrow
down arrow
to flip the card.
Question
Functions are placed within parentheses that follow a parameter name.
Question
The default label contains statements that execute when the value returned by the switch statement expression does not match any case label.
Question
A function executes automatically.
Question
If you attempt to use a local variable outside the function in which it is declared, you receive an error message.
Question
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.
Question
A function must contain a parameter.
Question
Using parentheses to enclose the conditional expression of an if statement is optional.
Question
Global variables are automatically available to all parts of your program, including functions.
Question
The formal parameters within the parentheses of a function declaration are global variables.
Question
A function must return a value.
Question
When one decision-making statement is contained within another decision-making statement, they are referred to as multiple decision-making structures.
Question
Variable scope refers to the location that a declared variable can be used.
Question
A return statement is a statement that returns a value to the statement that called the function.
Question
Function arguments are the statements that do the actual work of the function and must be contained within the function braces.
Question
The else clause can only be used with an if statement.
Question
The switch statement controls program flow by executing a specific set of statements, depending on the value of an expression.
Question
If a command block is missing either the opening or closing brace, an error occurs.
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.
Question
A function definition contains the lines of code that make up a function.
Question
Include statements support only absolute path notation.
Question
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.
Question
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.
Question
A command block is a group of statements within a set of opening and closing ____.

A) brackets
B) braces
C) parentheses
D) quotation marks
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.

A) repeat
B) replicate
C) loop
D) circular
Question
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
Question
You can use the terminate statement to halt a looping statement and restart the loop with a new iteration.
Question
With many programming languages, global variables are automatically available to all parts of your program, including ____.

A) statements
B) definitions
C) functions
D) declarations
Question
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
Question
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
Question
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
Question
Which of the following terms is not associated with the switch statement?

A) switch title
B) case label
C) executable statements
D) break keyword
Question
The statements in a do...while statement always execute repeatedly before the conditional expression evaluates the count variable.
Question
The include statement and the require statement perform the same function and can be used interchangeably.
Question
The parameters within the parentheses of a function declaration are what kind of variables?

A) local
B) global
C) unknown
D) declared
Question
You will not receive an error if you attempt to use a foreach statement with any variable types other than arrays.
Question
The for statement performs essentially the same function as the while statement.
Question
The do...while statement executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Question
A variable's scope can be either global or ____.

A) local
B) undeclared
C) universal
D) declared
Question
The for...while statement is used to iterate or loop through the elements in an array.
Question
An if statement that includes an else clause is called a(n) ____________________ statement.
Question
The ____ file is typically saved with a prefix of inc_.

A) insert
B) include
C) nested
D) increment
Question
You must use the ____________________ keyword to declare a global variable within the scope of a function.
Question
The ____________________ statement is used to execute specific programming code if the evaluation of a conditional expression returns a value of true.
Question
When one decision-making statement is contained within another decision-making statement, they are called ____________________ decision-making structures.
Question
A ____________________ variable is declared outside a function and is available to all parts of the program.
Question
A formal ____________________ is a variable that is used within a function.
Question
____________________-control statements allow you to determine the order in which statements execute in a program.
Question
A ____________________ variable is declared inside a function and is only available within the function in which it is declared.
Question
A ____________________ statement is a statement that returns a value to the statement that called the function.
Question
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.
Question
A ____ statement is used to iterate or loop through the elements in an array.

A) for
B) while
C) foreach
D) if...else
Question
Groups of statements you can execute as a single unit are called ____________________.
Question
A function ____________________ executes a function
Question
A ____ is a variable that increments or decrements with each iteration of a loop statement

A) counter
B) incrementer/decrementer
C) iterator
D) repetitor
Question
____________________ are added to both the if and else portions of the if...else statement if a section contains more than one statement.
Question
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
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.

A) continuous
B) continuing
C) constant
D) infinite
Question
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
Question
The function ____________________ is the lines of code that make up a function
Question
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.
Question
The ____________________ statement repeats a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Question
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.
Question
The ____________________ loop executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Question
You must include a(n) ____________________ to separate each section in a for loop.
Question
The ____________________ statement controls program flow using a case statement that executing a specific set of statements, depending on the value of an expression.
Question
case $ExampleVar is an example of a ____________________ data type being used as a case label
Question
A ____________________ is a variable that increments or decrements with each iteration of a loop statement.
Question
The ____________________ statement is used to iterate or loop through the elements in an array.
Question
A ____________________ statement keeps repeating until its conditional expression evaluates to FALSE.
Question
The final ____________________ statement after the final case or default statement is not required.
Question
Each repetition of a looping statement is called a(n) ____________________.
Question
case 42 is an example of a ____________________ data type being used as a case label.
Question
The ____________________ statement is used for repeating a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Question
The switch statement compares the value of an expression to a value contained within a special statement called a ____________________.
Question
case 125.78 is an example of a ____________________ data type being used as a case label.
Question
In a(n) ____________________ loop, a loop statement never ends because its conditional expression is never FALSE.
Question
The ____________________ label contains statements that execute when the value returned by the switch statement expression does not match a case label.
Question
case "Monday" is an example of a ____________________ data type being used as a case label.
Question
The conditional expression in the while statement is enclosed within ____________________ following the keyword while.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/83
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 2: Functions and Control Structures
1
Like variables, function names are case sensitive.
False
2
Functions are placed within parentheses that follow a parameter name.
False
3
The default label contains statements that execute when the value returned by the switch statement expression does not match any case label.
True
4
A function executes automatically.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
5
If you attempt to use a local variable outside the function in which it is declared, you receive an error message.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
6
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
7
A function must contain a parameter.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
8
Using parentheses to enclose the conditional expression of an if statement is optional.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
9
Global variables are automatically available to all parts of your program, including functions.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
10
The formal parameters within the parentheses of a function declaration are global variables.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
11
A function must return a value.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
12
When one decision-making statement is contained within another decision-making statement, they are referred to as multiple decision-making structures.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
13
Variable scope refers to the location that a declared variable can be used.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
14
A return statement is a statement that returns a value to the statement that called the function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
15
Function arguments are the statements that do the actual work of the function and must be contained within the function braces.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
16
The else clause can only be used with an if statement.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
17
The switch statement controls program flow by executing a specific set of statements, depending on the value of an expression.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
18
If a command block is missing either the opening or closing brace, an error occurs.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
19
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
20
A function definition contains the lines of code that make up a function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
21
Include statements support only absolute path notation.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
22
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
23
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
24
A command block is a group of statements within a set of opening and closing ____.

A) brackets
B) braces
C) parentheses
D) quotation marks
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
25
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
26
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
27
You can use the terminate statement to halt a looping statement and restart the loop with a new iteration.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
28
With many programming languages, global variables are automatically available to all parts of your program, including ____.

A) statements
B) definitions
C) functions
D) declarations
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
29
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
30
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
32
Which of the following terms is not associated with the switch statement?

A) switch title
B) case label
C) executable statements
D) break keyword
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
33
The statements in a do...while statement always execute repeatedly before the conditional expression evaluates the count variable.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
34
The include statement and the require statement perform the same function and can be used interchangeably.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
35
The parameters within the parentheses of a function declaration are what kind of variables?

A) local
B) global
C) unknown
D) declared
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
36
You will not receive an error if you attempt to use a foreach statement with any variable types other than arrays.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
37
The for statement performs essentially the same function as the while statement.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
38
The do...while statement executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
39
A variable's scope can be either global or ____.

A) local
B) undeclared
C) universal
D) declared
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
40
The for...while statement is used to iterate or loop through the elements in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
41
An if statement that includes an else clause is called a(n) ____________________ statement.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
42
The ____ file is typically saved with a prefix of inc_.

A) insert
B) include
C) nested
D) increment
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
43
You must use the ____________________ keyword to declare a global variable within the scope of a function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
44
The ____________________ statement is used to execute specific programming code if the evaluation of a conditional expression returns a value of true.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
45
When one decision-making statement is contained within another decision-making statement, they are called ____________________ decision-making structures.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
46
A ____________________ variable is declared outside a function and is available to all parts of the program.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
47
A formal ____________________ is a variable that is used within a function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
48
____________________-control statements allow you to determine the order in which statements execute in a program.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
49
A ____________________ variable is declared inside a function and is only available within the function in which it is declared.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
50
A ____________________ statement is a statement that returns a value to the statement that called the function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
51
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
52
A ____ statement is used to iterate or loop through the elements in an array.

A) for
B) while
C) foreach
D) if...else
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
53
Groups of statements you can execute as a single unit are called ____________________.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
54
A function ____________________ executes a function
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
55
A ____ is a variable that increments or decrements with each iteration of a loop statement

A) counter
B) incrementer/decrementer
C) iterator
D) repetitor
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
56
____________________ are added to both the if and else portions of the if...else statement if a section contains more than one statement.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
57
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
58
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
59
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
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
60
The function ____________________ is the lines of code that make up a function
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
61
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
62
The ____________________ statement repeats a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
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.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
64
The ____________________ loop executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
65
You must include a(n) ____________________ to separate each section in a for loop.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
66
The ____________________ statement controls program flow using a case statement that executing a specific set of statements, depending on the value of an expression.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
67
case $ExampleVar is an example of a ____________________ data type being used as a case label
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
68
A ____________________ is a variable that increments or decrements with each iteration of a loop statement.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
69
The ____________________ statement is used to iterate or loop through the elements in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
70
A ____________________ statement keeps repeating until its conditional expression evaluates to FALSE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
71
The final ____________________ statement after the final case or default statement is not required.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
72
Each repetition of a looping statement is called a(n) ____________________.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
73
case 42 is an example of a ____________________ data type being used as a case label.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
74
The ____________________ statement is used for repeating a statement or series of statements as long as a given conditional expression evaluates to TRUE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
75
The switch statement compares the value of an expression to a value contained within a special statement called a ____________________.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
76
case 125.78 is an example of a ____________________ data type being used as a case label.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
77
In a(n) ____________________ loop, a loop statement never ends because its conditional expression is never FALSE.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
78
The ____________________ label contains statements that execute when the value returned by the switch statement expression does not match a case label.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
79
case "Monday" is an example of a ____________________ data type being used as a case label.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
80
The conditional expression in the while statement is enclosed within ____________________ following the keyword while.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 83 flashcards in this deck.