Deck 3: Building Arrays and Controlling Flow

Full screen (f)
exit full mode
Question
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
Use Space or
up arrow
down arrow
to flip the card.
Question
The conditional expression in the   while  statement  is enclosed within ____ following the keyword while .

A) slashes
B) parentheses
C) asterisks
D) dashes
Question
A set of statements contained within a set of braces is known as a(n)____ block.

A) reference
B) instance
C) object
D) command
Question
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
Question
A break statement restarts a loop with a new iteration.
Question
A(n)____ statement is used to end the execution of a switch statement.

A) else
B) continue
C) break
D) default
Question
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.
Question
Case labels must be discrete values and cannot use operators.
Question
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
Question
Each piece of data contained in an array is called a(n)____.

A) index
B) range
C) element
D) column
Question
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
Question
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
Question
An if statement keeps repeating until its conditional expression evaluates to false.
Question
Each repetition of a looping statement is called a(n)____.

A) case
B) element
C) iteration
D) condition
Question
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
Question
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
Question
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
Question
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
Question
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
Question
You can think of an array as a collection of variables contained within a single variable.
Question
Match between columns
Compares the value of an expression to a value contained within a special statement called a case label
array literal
Compares the value of an expression to a value contained within a special statement called a case label
array
Compares the value of an expression to a value contained within a special statement called a case label
index
Compares the value of an expression to a value contained within a special statement called a case label
length property
Compares the value of an expression to a value contained within a special statement called a case label
if statement
Compares the value of an expression to a value contained within a special statement called a case label
command block
Compares the value of an expression to a value contained within a special statement called a case label
controlling flow
Compares the value of an expression to a value contained within a special statement called a case label
switch statement
Compares the value of an expression to a value contained within a special statement called a case label
counter
Contains a set of data represented by a single variable name
array literal
Contains a set of data represented by a single variable name
array
Contains a set of data represented by a single variable name
index
Contains a set of data represented by a single variable name
length property
Contains a set of data represented by a single variable name
if statement
Contains a set of data represented by a single variable name
command block
Contains a set of data represented by a single variable name
controlling flow
Contains a set of data represented by a single variable name
switch statement
Contains a set of data represented by a single variable name
counter
Returns the number of elements in an array
array literal
Returns the number of elements in an array
array
Returns the number of elements in an array
index
Returns the number of elements in an array
length property
Returns the number of elements in an array
if statement
Returns the number of elements in an array
command block
Returns the number of elements in an array
controlling flow
Returns the number of elements in an array
switch statement
Returns the number of elements in an array
counter
A single statement that declares a variable and specifies array values as its content
array literal
A single statement that declares a variable and specifies array values as its content
array
A single statement that declares a variable and specifies array values as its content
index
A single statement that declares a variable and specifies array values as its content
length property
A single statement that declares a variable and specifies array values as its content
if statement
A single statement that declares a variable and specifies array values as its content
command block
A single statement that declares a variable and specifies array values as its content
controlling flow
A single statement that declares a variable and specifies array values as its content
switch statement
A single statement that declares a variable and specifies array values as its content
counter
Changing the order in which JavaScript code is executed
array literal
Changing the order in which JavaScript code is executed
array
Changing the order in which JavaScript code is executed
index
Changing the order in which JavaScript code is executed
length property
Changing the order in which JavaScript code is executed
if statement
Changing the order in which JavaScript code is executed
command block
Changing the order in which JavaScript code is executed
controlling flow
Changing the order in which JavaScript code is executed
switch statement
Changing the order in which JavaScript code is executed
counter
A set of statements contained within a set of braces
array literal
A set of statements contained within a set of braces
array
A set of statements contained within a set of braces
index
A set of statements contained within a set of braces
length property
A set of statements contained within a set of braces
if statement
A set of statements contained within a set of braces
command block
A set of statements contained within a set of braces
controlling flow
A set of statements contained within a set of braces
switch statement
A set of statements contained within a set of braces
counter
An element's numeric position within an array
array literal
An element's numeric position within an array
array
An element's numeric position within an array
index
An element's numeric position within an array
length property
An element's numeric position within an array
if statement
An element's numeric position within an array
command block
An element's numeric position within an array
controlling flow
An element's numeric position within an array
switch statement
An element's numeric position within an array
counter
The most common type of decision-making statement
array literal
The most common type of decision-making statement
array
The most common type of decision-making statement
index
The most common type of decision-making statement
length property
The most common type of decision-making statement
if statement
The most common type of decision-making statement
command block
The most common type of decision-making statement
controlling flow
The most common type of decision-making statement
switch statement
The most common type of decision-making statement
counter
A variable that is incremented or decremented with each iteration of a loop statement
array literal
A variable that is incremented or decremented with each iteration of a loop statement
array
A variable that is incremented or decremented with each iteration of a loop statement
index
A variable that is incremented or decremented with each iteration of a loop statement
length property
A variable that is incremented or decremented with each iteration of a loop statement
if statement
A variable that is incremented or decremented with each iteration of a loop statement
command block
A variable that is incremented or decremented with each iteration of a loop statement
controlling flow
A variable that is incremented or decremented with each iteration of a loop statement
switch statement
A variable that is incremented or decremented with each iteration of a loop statement
counter
Question
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()
Question
What is the difference between an if statement and an if/else statement?
Question
What is the difference between the while and  do/while statements?
Question
What is a counter, and how is it used in programming?
Question
Each repetition of a looping statement is called a(n)____________________ .
Question
How is a for statement different from a while statement?
Question
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
Question
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
Question
A ____ statement restarts a loop with a new iteration.

A) break
B) continue
C) next
D) default
Question
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.
Question
Which of the following references the second element in the newsSections array?

A) newsSections[1]
B)newsSections[2]
C)newsSections(1)
D) newsSections(2)
Question
Changing the order in which JavaScript code is executed is known as  ____________________.
Question
Placing one decision-making statement within another decision-making statement creates  a(n)____________________  decision-making structure .
Question
Explain how to use an array literal to declare an array.
Question
In a(n)____________________ loop, a loop statement never ends because its conditional expression is never falsy.
Question
Define decision making and describe its role in programming.
Question
Describe the four steps that occur when a JavaScript interpreter encounters a for statement.
Question
What are loop statements used for in programming?
Question
Explain how index numbers are assigned to array elements and give an example.
Question
Explain what fallthrough is and how to prevent it.
Question
Explain how you access an element's value in an array.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/42
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
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
C
2
The conditional expression in the   while  statement  is enclosed within ____ following the keyword while .

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
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
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
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
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
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
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
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
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
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
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
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
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
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
Compares the value of an expression to a value contained within a special statement called a case label
array literal
Compares the value of an expression to a value contained within a special statement called a case label
array
Compares the value of an expression to a value contained within a special statement called a case label
index
Compares the value of an expression to a value contained within a special statement called a case label
length property
Compares the value of an expression to a value contained within a special statement called a case label
if statement
Compares the value of an expression to a value contained within a special statement called a case label
command block
Compares the value of an expression to a value contained within a special statement called a case label
controlling flow
Compares the value of an expression to a value contained within a special statement called a case label
switch statement
Compares the value of an expression to a value contained within a special statement called a case label
counter
Contains a set of data represented by a single variable name
array literal
Contains a set of data represented by a single variable name
array
Contains a set of data represented by a single variable name
index
Contains a set of data represented by a single variable name
length property
Contains a set of data represented by a single variable name
if statement
Contains a set of data represented by a single variable name
command block
Contains a set of data represented by a single variable name
controlling flow
Contains a set of data represented by a single variable name
switch statement
Contains a set of data represented by a single variable name
counter
Returns the number of elements in an array
array literal
Returns the number of elements in an array
array
Returns the number of elements in an array
index
Returns the number of elements in an array
length property
Returns the number of elements in an array
if statement
Returns the number of elements in an array
command block
Returns the number of elements in an array
controlling flow
Returns the number of elements in an array
switch statement
Returns the number of elements in an array
counter
A single statement that declares a variable and specifies array values as its content
array literal
A single statement that declares a variable and specifies array values as its content
array
A single statement that declares a variable and specifies array values as its content
index
A single statement that declares a variable and specifies array values as its content
length property
A single statement that declares a variable and specifies array values as its content
if statement
A single statement that declares a variable and specifies array values as its content
command block
A single statement that declares a variable and specifies array values as its content
controlling flow
A single statement that declares a variable and specifies array values as its content
switch statement
A single statement that declares a variable and specifies array values as its content
counter
Changing the order in which JavaScript code is executed
array literal
Changing the order in which JavaScript code is executed
array
Changing the order in which JavaScript code is executed
index
Changing the order in which JavaScript code is executed
length property
Changing the order in which JavaScript code is executed
if statement
Changing the order in which JavaScript code is executed
command block
Changing the order in which JavaScript code is executed
controlling flow
Changing the order in which JavaScript code is executed
switch statement
Changing the order in which JavaScript code is executed
counter
A set of statements contained within a set of braces
array literal
A set of statements contained within a set of braces
array
A set of statements contained within a set of braces
index
A set of statements contained within a set of braces
length property
A set of statements contained within a set of braces
if statement
A set of statements contained within a set of braces
command block
A set of statements contained within a set of braces
controlling flow
A set of statements contained within a set of braces
switch statement
A set of statements contained within a set of braces
counter
An element's numeric position within an array
array literal
An element's numeric position within an array
array
An element's numeric position within an array
index
An element's numeric position within an array
length property
An element's numeric position within an array
if statement
An element's numeric position within an array
command block
An element's numeric position within an array
controlling flow
An element's numeric position within an array
switch statement
An element's numeric position within an array
counter
The most common type of decision-making statement
array literal
The most common type of decision-making statement
array
The most common type of decision-making statement
index
The most common type of decision-making statement
length property
The most common type of decision-making statement
if statement
The most common type of decision-making statement
command block
The most common type of decision-making statement
controlling flow
The most common type of decision-making statement
switch statement
The most common type of decision-making statement
counter
A variable that is incremented or decremented with each iteration of a loop statement
array literal
A variable that is incremented or decremented with each iteration of a loop statement
array
A variable that is incremented or decremented with each iteration of a loop statement
index
A variable that is incremented or decremented with each iteration of a loop statement
length property
A variable that is incremented or decremented with each iteration of a loop statement
if statement
A variable that is incremented or decremented with each iteration of a loop statement
command block
A variable that is incremented or decremented with each iteration of a loop statement
controlling flow
A variable that is incremented or decremented with each iteration of a loop statement
switch statement
A variable that is incremented or decremented with each iteration of a loop statement
counter
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()
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
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
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
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)
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
locked card icon
Unlock Deck
Unlock for access to all 42 flashcards in this deck.