Deck 10: Exploring Arrays Loops and Conditional Statements Tutorial
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
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
Match between columns
Question
Question
Match between columns
Premises:
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
Responses:
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/73
Play
Full screen (f)
Deck 10: Exploring Arrays Loops and Conditional Statements Tutorial
1
Increasing the value of the length property adds more items to an array, but the items have null values until they are defined.
True
2
A command block is indicated by its opening and closing square brackets [ ].
False
3
By default, items are placed in an array either in the order in which they are defined or explicitly by index number.
True
4
The getDate() method in a calendar app returns an integer ranging from 0 (Sunday) to 6 (Saturday).
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
5
The break statement runs a command or a command block only if the conditional expression returns the value true ; it does nothing if the condition is false.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
6
The appearance of any form element can be changed by modifying style sheets instead of the JavaScript code.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
7
When a pass statement is encountered, control is passed to the statement immediately following it.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
8
The do/while loop is generally used when the program loop should run at least once before testing for the stopping condition.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
9
In an if loop, a variable known as a counter variable is used to track the number of times a block of commands is run.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
10
A calendar that is created as a web table can have class and ID designations to make it easy for page developers to assign different styles to different parts of the calendar.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
11
Statement labels are used to identify statements in JavaScript code so that the statements can be referenced elsewhere in a program.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
12
The every(callback [, thisArg]) array method applies the callback function to each item in an array.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
13
In an array literal, the array values are a space-separated list within a set of curly brackets.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
14
The slice() method reverses the order of items in an array, making the last items first and the first items last.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
15
T he value of the length property can be reduced without removing items from an array.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
16
The map(callback [, thisArg]) method returns the index of the first element in the array that passes a test in the callback function.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
17
Index values start with 1 so that the initial item in an array has an index value of 1, the second item has an index value of 2, and so on.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
18
JavaScript supports logical operators that connect several expressions.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
19
When each entry in an array matches the entry in another array, it is called a linear array.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
20
The while statement is used to exit a program loop before the stopping condition is met.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
21
What is the output of the following code? for(var i = 5; i > 0; i--)
A) i = 4, 3, 2, 1, 0
B) i = 5, 4, 3, 2, 1
C) i = 0, 1, 2, 3, 4
D) i = 1, 2, 3, 4, 5
A) i = 4, 3, 2, 1, 0
B) i = 5, 4, 3, 2, 1
C) i = 0, 1, 2, 3, 4
D) i = 1, 2, 3, 4, 5
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
22
A _____, which employs the first-in-first-out (FIFO) principle in which the first item added to the data list is the first removed, is similar to a stack.
A) frame
B) bitmap
C) queue
D) binary tree
A) frame
B) bitmap
C) queue
D) binary tree
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following examples tests whether x is equal to 5 or y is equal to 8?
A) (x === 5) && (y === 8)
B) (x === 5) : (y === 8)
C) (x === 5) || (y === 8)
D) (x === 5) / (y === 8)
A) (x === 5) && (y === 8)
B) (x === 5) : (y === 8)
C) (x === 5) || (y === 8)
D) (x === 5) / (y === 8)
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
24
Identify the expression used to reference array values.
A) array()
B) array [ i ]
C) array { array1 , array2 ,…}
D) array:: values
A) array()
B) array [ i ]
C) array { array1 , array2 ,…}
D) array:: values
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
25
Identify a method that is used to create a subarray.
A) concat()
B) slice()
C) assert()
D) sort()
A) concat()
B) slice()
C) assert()
D) sort()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
26
Identify a compare function that sorts numeric values in ascending order.
A) function ascending(a, b) { return a - b; }
B) function ascending(b, a) { return a; }
C) function ascending(a, b) { return b - a; }
D) function ascending(b, a) { return b; }
A) function ascending(a, b) { return a - b; }
B) function ascending(b, a) { return a; }
C) function ascending(a, b) { return b - a; }
D) function ascending(b, a) { return b; }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
27
Identify the general structure of a for loop.
A) for ( start ; continue ; update ) { commands }
B) for ( start ; update) { commands }
C) for ( start ; stop ) { commands }
D) for ( start ; stop ; continue ) { commands }
A) for ( start ; continue ; update ) { commands }
B) for ( start ; update) { commands }
C) for ( start ; stop ) { commands }
D) for ( start ; stop ; continue ) { commands }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
28
What is the output of the following code? for (var i = 0; i
A) i = 0, 60, 120, 180, 240, 360
B) i = 360, 240, 180, 120, 60, 0
C) i = 60, 120, 240, 480, 960
D) i = 600, 300, 240, 180, 120, 60
A) i = 0, 60, 120, 180, 240, 360
B) i = 360, 240, 180, 120, 60, 0
C) i = 60, 120, 240, 480, 960
D) i = 600, 300, 240, 180, 120, 60
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
29
A(n) _____ is a collection of values organized under a single name.
A) index
B) heap
C) array
D) tuple
A) index
B) heap
C) array
D) tuple
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
30
Numeric data can be sorted by creating a(n) _____ function that contrasts the values of two adjacent array items.
A) sum
B) iteration
C) assert
D) compare
A) sum
B) iteration
C) assert
D) compare
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
31
Identify a compare function that sorts numeric values in descending order.
A) function descending(a, b) { return a - b; }
B) function descending(b, a) { return b; }
C) function descending(a, b) { return b - a; }
D) function descending(b, a) { return a; }
A) function descending(a, b) { return a - b; }
B) function descending(b, a) { return b; }
C) function descending(a, b) { return b - a; }
D) function descending(b, a) { return a; }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
32
The _____ loop tests the condition to continue the loop right after the latest command block is run.
A) do/while
B) while
C) for
D) forEach
A) do/while
B) while
C) for
D) forEach
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
33
Identify the syntax of the while loop.
A) while ( continue ) { commands }
B) while ( start ) { commands }
C) while [ start;stop ] { commands }
D) while [ update ; continue ] { commands }
A) while ( continue ) { commands }
B) while ( start ) { commands }
C) while [ start;stop ] { commands }
D) while [ update ; continue ] { commands }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
34
Identify the output of the following code. var x = [3, 45, 1234, 24]; x.sort();
A) 1234, 24, 3, 45
B) 3, 24, 45, 1234
C) 1234, 45, 24, 3
D) 1234, 24, 45
A) 1234, 24, 3, 45
B) 3, 24, 45, 1234
C) 1234, 45, 24, 3
D) 1234, 24, 45
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
35
The _____ operator tests whether two items are equal in value and have the same data type.
A) = =
B) = = =
C) =
D) !=
A) = =
B) = = =
C) =
D) !=
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
36
Identify a method that inserts new items at the front of an array.
A) reverse()
B) unshift()
C) assert()
D) sort()
A) reverse()
B) unshift()
C) assert()
D) sort()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
37
Identify the general syntax of the do/while loop.
A) do ( continue ) { commands } while ( continue ){ commands }
B) while ( continue ) { commands } do ( continue ){ commands }
C) while { commands } do ( continue );
D) do { commands } while ( continue );
A) do ( continue ) { commands } while ( continue ){ commands }
B) while ( continue ) { commands } do ( continue ){ commands }
C) while { commands } do ( continue );
D) do { commands } while ( continue );
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
38
For array data that should be treated as a queue, the _____ method is used, which is similar to the pop() method except that it removes the first array item and not the last.
A) reverse()
B) shift()
C) assert()
D) sort()
A) reverse()
B) shift()
C) assert()
D) sort()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
39
What is the output of the following code? var x = ["a", "b", "c"]; x.push("d", "e"); x.pop(); x.pop();
A) x = ["a", "b", "c"]
B) x = ["a", "b", "d", "e"]
C) x = ["d", "e"]
D) x = ["c", "d", "e"]
A) x = ["a", "b", "c"]
B) x = ["a", "b", "d", "e"]
C) x = ["d", "e"]
D) x = ["c", "d", "e"]
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following determines the current size of an array?
A) array (length)
B) array [length]
C) array .length
D) array ::length
A) array (length)
B) array [length]
C) array .length
D) array ::length
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
41
The _____ method performs an action similar to the forEach() method except that the function it calls returns a value that can be used to match the contents of an existing array into a new array.
A) sort()
B) map()
C) splice()
D) find()
A) sort()
B) map()
C) splice()
D) find()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
42
Identify the structure of an if statement
A) if (condition) { commands }
B) if { }(condition)
C) if { commands }
D) if { } (condition){ commands
A) if (condition) { commands }
B) if { }(condition)
C) if { commands }
D) if { } (condition){ commands
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following statements is used to terminate any program loop or conditional statement?
A) for
B) while
C) pass
D) break
A) for
B) while
C) pass
D) break
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
44
Which of the following functions increases the value of each item in an array by 1?
A) sum()
B) AddArray()
C) StepUp()
D) ceil()
A) sum()
B) AddArray()
C) StepUp()
D) ceil()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
45
Identify a true statement of array .find( callback [, thisArg ]) method.
A) It tests whether the condition returned by the callback function holds for at least one item in array .
B) It returns the value of the first element in the array that passes a test in the callback function.
C) It tests whether the condition returned by the callback function holds for all items in array .
D) It returns the index of the first element in the array that passes a test in the callback function.
A) It tests whether the condition returned by the callback function holds for at least one item in array .
B) It returns the value of the first element in the array that passes a test in the callback function.
C) It tests whether the condition returned by the callback function holds for all items in array .
D) It returns the index of the first element in the array that passes a test in the callback function.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
46
What is the output of the following code? var x = [4, 7, 11]; x.forEach(stepUp); function stepUp(value, i, arr) { arr[i] = value + 1; }
A) 4, 7, 11
B) 3, 7, 11
C) 5, 8, 12
D) 8, 14, 22
A) 4, 7, 11
B) 3, 7, 11
C) 5, 8, 12
D) 8, 14, 22
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
47
Which of the following methods is used to determine the day of the week on which a month starts?
A) calDay;
B) day.calDay()
C) find.Day;
D) getDay()
A) calDay;
B) day.calDay()
C) find.Day;
D) getDay()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
48
What is the output of the following code? var sum = 0; var x = [1, 3, 7, 11]; x.forEach(sumArray); function sumArray(value) { sum += value; }
A) 0
B) 231
C) 11
D) 22
A) 0
B) 231
C) 11
D) 22
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
49
Identify the expression in which the initial value of the day variable will be set to match the first day of the calendar month.
A) var day = Date(calDate(), calDate.getDay(), 1);
B) var day = new Day(calDate.getDD(), calDate.getMM(),calDate.getYY(),1);
C) var day = new Day(calDay.getFullMonth(), calDay.getDate(), 1);
D) var day = new Date(calDate.getFullYear(), calDate.getMonth(), 1);
A) var day = Date(calDate(), calDate.getDay(), 1);
B) var day = new Day(calDate.getDD(), calDate.getMM(),calDate.getYY(),1);
C) var day = new Day(calDay.getFullMonth(), calDay.getDate(), 1);
D) var day = new Date(calDate.getFullYear(), calDate.getMonth(), 1);
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
50
Which of the following values will the expression 15 % 4 return?
A) 1
B) 11
C) 3
D) 60
A) 1
B) 11
C) 3
D) 60
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
51
The _____ method creates a new array by passing the original array items to the callback function, which returns the equivalent value of the array items.
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
52
Identify the general syntax of the forEach method.
A) array.forEach [, thisArg ]() { commands }
B) array.forEach( callback [, thisArg ])
C) array.forEach ( value ){ commands }
D) array.forEach( callback [ value ])
A) array.forEach [, thisArg ]() { commands }
B) array.forEach( callback [, thisArg ])
C) array.forEach ( value ){ commands }
D) array.forEach( callback [ value ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
53
Identify a method that extracts array items that match a specified condition.
A) sort()
B) filter()
C) splice()
D) reverse()
A) sort()
B) filter()
C) splice()
D) reverse()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
54
Which of the following methods creates a new array populated with the elements of array that return a value of true from the callback function?
A) array .every( callback [, thisArg ])
B) array .filter( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
A) array .every( callback [, thisArg ])
B) array .filter( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
55
Identify a method that tests whether the condition returned by the callback function holds for all items in an array .
A) array .every( callback [, thisArg ])
B) array .filter( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
A) array .every( callback [, thisArg ])
B) array .filter( callback [, thisArg ])
C) array .some( callback [, thisArg ])
D) array .find( callback [, thisArg ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
56
What is the output of the following code? var scores = [92, 68, 83, 95, 91, 65, 77]; var highScores = scores.filter(gradeA); function gradeA(value) { return value > 90; }
A) [92, 95, 91]
B) [96, 97, 98]
C) [68, 83, 65, 77]
D) [91, 92, 65, 68, 77, 83]
A) [92, 95, 91]
B) [96, 97, 98]
C) [68, 83, 65, 77]
D) [91, 92, 65, 68, 77, 83]
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
57
Identify a method that decreases array by keeping only those items that return a value of true from the callback function.
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .reduce( callback [, thisArg ])
D) array .find( callback [, thisArg ])
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .reduce( callback [, thisArg ])
D) array .find( callback [, thisArg ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
58
Identify the general structure for accessing each value from an array using a for loop.
A) for ( i array ; i ++) { commands involving array [ i ] }
B) for (var i = 0; i ++; i array .length) { commands involving array ( i) }
C) for (var i = 0; i ++) { commands involving array ( i) }
D) for (var i = 0; i array .length; i ++) { commands involving array [ i ] }
A) for ( i array ; i ++) { commands involving array [ i ] }
B) for (var i = 0; i ++; i array .length) { commands involving array ( i) }
C) for (var i = 0; i ++) { commands involving array ( i) }
D) for (var i = 0; i array .length; i ++) { commands involving array [ i ] }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
59
The _____ method diminishes array from the last element by keeping only those items that return a value of true from the callback function.
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .reduceRight( callback [, thisArg ])
D) array .findIndex( callback [, thisArg ])
A) array .every( callback [, thisArg ])
B) array .map( callback [, thisArg ])
C) array .reduceRight( callback [, thisArg ])
D) array .findIndex( callback [, thisArg ])
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
60
Identify a true statement of array .some( callback [, thisArg ]) method.
A) It tests whether the condition returned by the callback function holds for at least one item in array .
B) It returns the value of the first element in the array that passes a test in the callback function.
C) It tests whether the condition returned by the callback function holds for all items in array .
D) It returns the index of the first element in the array that passes a test in the callback function.
A) It tests whether the condition returned by the callback function holds for at least one item in array .
B) It returns the value of the first element in the array that passes a test in the callback function.
C) It tests whether the condition returned by the callback function holds for all items in array .
D) It returns the index of the first element in the array that passes a test in the callback function.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
61
Match between columns
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
62
Case-Based Critical Thinking Questions Case 9-2 Gregor, a software developer, is developing a calendar application. He has to use several if conditional statements to ensure that the calendar displays the exact number of days present in each month of each year. He creates a dayCount array to keep track of the number of days in each month. Gregor wants to create a condition to ensure that all the years divisible by 4 should contain 29 days in February. Which of the following statements should he use?
A) if (thisYear % 4 === 0) { dayCount[1] = 29; }
B) if (this year/4 === 0) { dayCount[2] = 29; }
C) if (this year*4==0) { dayCount[1] = 29 }
D) if (thisYear % 4 dayCount[2] = 29; }
A) if (thisYear % 4 === 0) { dayCount[1] = 29; }
B) if (this year/4 === 0) { dayCount[2] = 29; }
C) if (this year*4==0) { dayCount[1] = 29 }
D) if (thisYear % 4 dayCount[2] = 29; }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
63
Match between columns
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
64
Case-Based Critical Thinking Questions Case 9-1 Melissa, a computer science engineering student, is learning the basics of programming by exploring arrays. She learns about different array methods. She wishes to learn more on inserting and deleting array items. She creates monthName array to extract only the three spring months-March, April, and May-from a calendar. Melissa wants to extract the spring months and store them in the monthName array. Identify a method Melissa should choose to perform this task.
A) springMonths = monthName.slice(2, 5);
B) springMonths = monthName.splice(2, 3);
C) springMonths = monthName.slice(3, 5);
D) springMonths = monthName.splice(5, 3);
A) springMonths = monthName.slice(2, 5);
B) springMonths = monthName.splice(2, 3);
C) springMonths = monthName.slice(3, 5);
D) springMonths = monthName.splice(5, 3);
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
65
Match between columns
Premises:
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method duplicates items within an array.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method converts the contents of an array to a text sequence with the array values in a comma-separated list.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method rearranges array items in alphabetical order.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method removes the first item from an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inserts new items at the start of an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method inverts the order of items in an array.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method joins the array to two or more arrays, creating a single array containing the items from all the arrays.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method appends an array with new items.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method removes the last item from an array.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
This method links all items in the array into a single text string.
Responses:
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
pop()
push(values
reverse()
shift()
array.unshift(values)
array.toString()
copyWithin(target, start[, end])
join(separator)
concat(array1, array2,...)
sort()
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
66
Describe the structure of the if else statement.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
67
The _____ statement stops processing the commands in the current iteration of the loop and proceeds to the next iteration instead of stopping the program loop altogether.
A) switch
B) else
C) continue
D) pass
A) switch
B) else
C) continue
D) pass
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
68
Case-Based Critical Thinking Questions Case 9-2 Gregor, a software developer, is developing a calendar application. He has to use several if conditional statements to ensure that the calendar displays the exact number of days present in each month of each year. He creates a dayCount array to keep track of the number of days in each month. Gregor wants to ensure February contains 29 days only in the year 2020 as it is a leap year. Which of the following should Gregor use to set the value in the dayCount array?
A) if (thisYear === 2020) { dayCount[1] = 29; }
B) if (dayCount=29) { 2020; }
C) if { thisYear = 2020; dayCount[1] == 29; }
D) if { dayCount=29 && this year=2020; }
A) if (thisYear === 2020) { dayCount[1] = 29; }
B) if (dayCount=29) { 2020; }
C) if { thisYear = 2020; dayCount[1] == 29; }
D) if { dayCount=29 && this year=2020; }
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
69
Briefly explain the process of using arrays as data stacks.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
70
Explain the length property of an array with examples.
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
71
Case-Based Critical Thinking Questions Case 9-1 Melissa, a computer science engineering student, is learning the basics of programming by exploring arrays. She learns about different array methods. She wishes to learn more on inserting and deleting array items. She creates monthName array to extract only the three spring months-March, April, and May-from a calendar. Melissa wants to remove spring months from the monthName array. Which of the following methods should Melissa use?
A) springMonths = monthName.slice(2, 5);
B) springMonths = monthName.splice(2, 3);
C) springMonths = monthName.slice(3, 5);
D) springMonths = monthName.splice(5, 3);
A) springMonths = monthName.slice(2, 5);
B) springMonths = monthName.splice(2, 3);
C) springMonths = monthName.slice(3, 5);
D) springMonths = monthName.splice(5, 3);
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
72
Case-Based Critical Thinking Questions Case 9-1 Melissa, a computer science engineering student, is learning the basics of programming by exploring arrays. She learns about different array methods. She wishes to learn more on inserting and deleting array items. She creates monthName array to extract only the three spring months-March, April, and May-from a calendar. Melissa wants to insert abbreviations of spring months into the monthName array. Which of the following methods should she use?
A) monthName.reverse(5, 3, "Mar", "Apr", "May");
B) monthName.sort(2, 3, "Mar", "Apr", "May");
C) monthName.join(5, 3, "Mar", "Apr", "May");
D) monthName.splice(2, 3, "Mar", "Apr", "May");
A) monthName.reverse(5, 3, "Mar", "Apr", "May");
B) monthName.sort(2, 3, "Mar", "Apr", "May");
C) monthName.join(5, 3, "Mar", "Apr", "May");
D) monthName.splice(2, 3, "Mar", "Apr", "May");
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck
73
Identify the syntax of the statement label.
A) label = {statements}
B) statement!(label)
C) label: statements
D) statements.label
A) label = {statements}
B) statement!(label)
C) label: statements
D) statements.label
Unlock Deck
Unlock for access to all 73 flashcards in this deck.
Unlock Deck
k this deck