Deck 3: Building Arrays and Controlling Flow
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/42
Play
Full screen (f)
Deck 3: Building Arrays and Controlling Flow
1
You use a(n)____ when you want to store a group or a list of related information in a single, easily managed location.
A) function
B) console
C) array
D) conditional statement
A) function
B) console
C) array
D) conditional statement
C
2
The conditional expression in the while statement is enclosed within ____ following the keyword while .
A) slashes
B) parentheses
C) asterisks
D) dashes
A) slashes
B) parentheses
C) asterisks
D) dashes
B
3
A set of statements contained within a set of braces is known as a(n)____ block.
A) reference
B) instance
C) object
D) command
A) reference
B) instance
C) object
D) command
D
4
A(n)____ label in a switch statement represents a specific value and is followed by one or more statements that are executed if the value of the label matches the value of the switch statement's expression.
A) if
B) default
C) case
D) break
A) if
B) default
C) case
D) break
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
5
A break statement restarts a loop with a new iteration.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
6
A(n)____ statement is used to end the execution of a switch statement.
A) else
B) continue
C) break
D) default
A) else
B) continue
C) break
D) default
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
7
You access an array element's value just as you access the value of any other variable, except that you include the element index in brackets.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
8
Case labels must be discrete values and cannot use operators.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
9
The ____ statement controls program flow by executing a specific set of statements, depending on the value of an expression.
A) if
B) while
C) if...else
D) switch
A) if
B) while
C) if...else
D) switch
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
10
Each piece of data contained in an array is called a(n)____.
A) index
B) range
C) element
D) column
A) index
B) range
C) element
D) column
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
11
The ____ statement is used to execute specific programming code if the evaluation of a conditional expression returns a truthy value.
A) default
B) continue
C) break
D) if
A) default
B) continue
C) break
D) if
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
12
Unlike the while statement, the statements in a ____ statement always execute once, before a conditional expression is evaluated.
A) do/continue
B) do/while
C) do/until
D) do/using
A) do/continue
B) do/while
C) do/until
D) do/using
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
13
An if statement keeps repeating until its conditional expression evaluates to false.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
14
Each repetition of a looping statement is called a(n)____.
A) case
B) element
C) iteration
D) condition
A) case
B) element
C) iteration
D) condition
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
15
A case label consists of the keyword case , followed by a literal value or variable name, followed by a ____.
A) semicolon
B) colon
C) period
D) comma
A) semicolon
B) colon
C) period
D) comma
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
16
The ____ label contains statements that execute when the value returned by the switch statement expression does not match a case label.
A) default
B) else
C) break
D) continue
A) default
B) else
C) break
D) continue
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
17
If you want to execute one set of statements when a condition evaluates to a truthy value and another set of statements when the condition evaluates to a falsy value, you need the ____ statement.
A) while
B) if/else
C) do/while
D) switch
A) while
B) if/else
C) do/while
D) switch
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
18
A ____ statement is a a control flow statement that repeatedly executes a statement or a series of statements while the value of a specific condition is truthy or until the value of a specific condition becomes truthy .
A) decision-making
B) fork
C) break
D) loop
A) decision-making
B) fork
C) break
D) loop
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
19
One of the simplest types of loop statements is the ____ statement, which repeats a statement or series of statements as long as a given conditional expression evaluates to a truthy value.
A) continue
B) while
C) switch
D) if
A) continue
B) while
C) switch
D) if
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
20
You can think of an array as a collection of variables contained within a single variable.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
21
Match between columns
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
22
Which method returns a collection of references to all instances of a certain element in an HTML document?
A)getElementById()
B) getElementsByName()
C)getElementsByTagName()
D)getElementsByClassName()
A)getElementById()
B) getElementsByName()
C)getElementsByTagName()
D)getElementsByClassName()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
23
What is the difference between an if statement and an if/else statement?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
24
What is the difference between the while and do/while statements?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
25
What is a counter, and how is it used in programming?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
26
Each repetition of a looping statement is called a(n)____________________ .
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
27
How is a for statement different from a while statement?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ statement is used to repeat a statement or series of statements as long as a given conditional expression evaluates to a truthy value.
A) for
B) continue
C) default
D) switch
A) for
B) continue
C) default
D) switch
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
29
A single statement that declares a variable and specifies array values as its content is called an array ____.
A)index
B)element
C)constructor
D)literal
A)index
B)element
C)constructor
D)literal
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
30
A ____ statement restarts a loop with a new iteration.
A) break
B) continue
C) next
D) default
A) break
B) continue
C) next
D) default
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
31
To end a switch statement once it performs its required task, include a(n)____________________ statement at the end of the statements associated with each case label.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
32
Which of the following references the second element in the newsSections array?
A) newsSections[1]
B)newsSections[2]
C)newsSections(1)
D) newsSections(2)
A) newsSections[1]
B)newsSections[2]
C)newsSections(1)
D) newsSections(2)
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
33
Changing the order in which JavaScript code is executed is known as ____________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
34
Placing one decision-making statement within another decision-making statement creates a(n)____________________ decision-making structure .
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
35
Explain how to use an array literal to declare an array.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
36
In a(n)____________________ loop, a loop statement never ends because its conditional expression is never falsy.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
37
Define decision making and describe its role in programming.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
38
Describe the four steps that occur when a JavaScript interpreter encounters a for statement.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
39
What are loop statements used for in programming?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
40
Explain how index numbers are assigned to array elements and give an example.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
41
Explain what fallthrough is and how to prevent it.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
42
Explain how you access an element's value in an array.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck