Deck 10: Exploring Arrays, loops, and Conditional Statements

Full screen (f)
exit full mode
Question
Statement labels are used to identify statements in JavaScript code so that the statements can be referenced elsewhere in a program.
Use Space or
up arrow
down arrow
to flip the card.
Question
When each entry in an array matches the entry in another array,it is called a linear array.
Question
In an array literal,the array values are a space-separated list within a set of curly brackets.
Question
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.
Question
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.
Question
The do/while loop is generally used when the program loop should run at least once before testing for the stopping condition.
Question
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.
Question
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.
Question
Increasing the value of the length property adds more items to an array,but the items have null values until they are defined.
Question
JavaScript supports logical operators that connect several expressions.
Question
The appearance of any form element can be changed by modifying style sheets instead of the JavaScript code.
Question
The every(callback [,thisArg])array method applies the callback function to each item in an array.
Question
The value of the length property can be reduced without removing items from an array.
Question
By default,items are placed in an array either in the order in which they are defined or explicitly by index number.
Question
The getDate()method in a calendar app returns an integer ranging from 0 (Sunday)to 6 (Saturday).
Question
When a pass statement is encountered,control is passed to the statement immediately following it.
Question
A command block is indicated by its opening and closing square brackets [ ].
Question
The map(callback [,thisArg])method returns the index of the first element in the array that passes a test in the callback function.
Question
The slice()method reverses the order of items in an array,making the last items first and the first items last.
Question
The while statement is used to exit a program loop before the stopping condition is met.
Question
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"]
Question
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);
Question
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
}
Question
Which of the following determines the current size of an array?

A) ​array(length)
B) ​array[length]
C) ​array.length
D) ​array::length
Question
Identify a method that is used to create a subarray.

A) ​concat()
B) ​slice()
C) ​assert()
D) ​sort()
Question
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
Question
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
}
Question
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
Question
What is the output of the following code?
For (var i = 0; i < = 360; i+=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
Question
Identify a method that inserts new items at the front of an array.

A) ​reverse()
B) ​unshift()
C) ​assert()
D) ​sort()
Question
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
Question
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
Question
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;
}
Question
Identify the expression used to reference array values.

A) ​array()
B) ​array[i]
C) ​array{array1,array2,…}
D) ​array::values
Question
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)
Question
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()
Question
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;
}
Question
The _____ operator tests whether two items are equal in value and have the same data type.

A) ​= =
B) ​= = =
C) ​=
D) ​!=
Question
A(n)_____ is a collection of values organized under a single name.

A) ​index
B) ​heap
C) ​array
D) ​tuple
Question
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
Question
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])
Question
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.
Question
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])
Question
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);
Question
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()
Question
Which of the following statements is used to terminate any program loop or conditional statement?

A) ​for
B) ​while
C) ​pass
D) ​break
Question
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])
Question
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]
Question
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
Question
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()
Question
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])
Question
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
Question
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.
Question
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])
Question
Which of the following functions increases the value of each item in an array by 1?

A) ​sum()
B) ​AddArray()
C) ​StepUp()
D) ​ceil()
Question
Which of the following values will the expression 15 % 4 return?

A) ​1
B) ​11
C) ​3
D) ​60
Question
Identify the structure of an if statement

A) if (condition){
Commands
}
B) ​if {
}(condition)
C) if {
Commands
}
D) ​if {
}
(condition){
Commands
Question
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]
}
Question
Identify a method that extracts array items that match a specified condition.

A) ​sort()
B) ​filter()
C) ​splice()
D) ​reverse()
Question
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])
Question
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");
Question

Identify the letter of the choice that best matches the phrase or definition.

-This method inverts the order of items in an array.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Question
JavaScript allows for the creation of _________,in which some array values are undefined.
Question
A _________ is an operator that compares the value of one expression to another returning a Boolean value indicating whether the comparison is true or not.
Question
The collection of commands that is run each time through a loop is known collectively as a _________.
Question
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;
}
Question
_________ is a number associated with each individual value in an array and distinguishes each value from other values in the array.
Question
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
Question
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);
Question
A _________ is a set of commands executed repeatedly until a stopping condition is met.
Question

Identify the letter of the choice that best matches the phrase or definition.

-This method appends an array with new items.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Question
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 < = 29){
DayCount[2] = 29;
}
Question
_________ is a section of an array.
Question
A _________ is a statement that runs a command or command block only when certain circumstances are met.
Question
A stack data structure employs the _________ principle in which the last items added to the stack are the first ones removed.
Question

Identify the letter of the choice that best matches the phrase or definition.

-This method removes the last item from an array.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Question
Identify the syntax of the statement label.

A) ​label = {statements}
B) ​statement!(label)
C) ​label: statements
D) ​statements.label
Question
Arrays can be used to store information in a data structure known as a _________ in which new items are added to the top or to the end of the array.
Question
The _________ returns the integer remainder after dividing one integer by another.
Question
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);
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/90
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Exploring Arrays, loops, and Conditional Statements
1
Statement labels are used to identify statements in JavaScript code so that the statements can be referenced elsewhere in a program.
True
2
When each entry in an array matches the entry in another array,it is called a linear array.
False
3
In an array literal,the array values are a space-separated list within a set of curly brackets.
False
4
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 90 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 90 flashcards in this deck.
Unlock Deck
k this deck
6
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 90 flashcards in this deck.
Unlock Deck
k this deck
7
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 90 flashcards in this deck.
Unlock Deck
k this deck
8
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 90 flashcards in this deck.
Unlock Deck
k this deck
9
Increasing the value of the length property adds more items to an array,but the items have null values until they are defined.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
10
JavaScript supports logical operators that connect several expressions.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
11
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 90 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 90 flashcards in this deck.
Unlock Deck
k this deck
13
The value of the length property can be reduced without removing items from an array.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
14
By default,items are placed in an array either in the order in which they are defined or explicitly by index number.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
15
The getDate()method in a calendar app returns an integer ranging from 0 (Sunday)to 6 (Saturday).
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
16
When a pass statement is encountered,control is passed to the statement immediately following it.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
17
A command block is indicated by its opening and closing square brackets [ ].
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
18
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 90 flashcards in this deck.
Unlock Deck
k this deck
19
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 90 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 90 flashcards in this deck.
Unlock Deck
k this deck
21
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"]
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
22
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);
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
23
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
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following determines the current size of an array?

A) ​array(length)
B) ​array[length]
C) ​array.length
D) ​array::length
Unlock Deck
Unlock for access to all 90 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()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
26
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
27
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
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
28
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
29
What is the output of the following code?
For (var i = 0; i < = 360; i+=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 90 flashcards in this deck.
Unlock Deck
k this deck
30
Identify a method that inserts new items at the front of an array.

A) ​reverse()
B) ​unshift()
C) ​assert()
D) ​sort()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
31
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
32
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
33
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;
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
34
Identify the expression used to reference array values.

A) ​array()
B) ​array[i]
C) ​array{array1,array2,…}
D) ​array::values
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
35
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)
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
36
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()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
37
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;
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
38
The _____ operator tests whether two items are equal in value and have the same data type.

A) ​= =
B) ​= = =
C) ​=
D) ​!=
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
39
A(n)_____ is a collection of values organized under a single name.

A) ​index
B) ​heap
C) ​array
D) ​tuple
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
40
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
41
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
42
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.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
43
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
44
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);
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
45
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()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
46
Which of the following statements is used to terminate any program loop or conditional statement?

A) ​for
B) ​while
C) ​pass
D) ​break
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
47
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
48
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]
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
49
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
50
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()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
51
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
52
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
53
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.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
54
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
55
Which of the following functions increases the value of each item in an array by 1?

A) ​sum()
B) ​AddArray()
C) ​StepUp()
D) ​ceil()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
56
Which of the following values will the expression 15 % 4 return?

A) ​1
B) ​11
C) ​3
D) ​60
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
57
Identify the structure of an if statement

A) if (condition){
Commands
}
B) ​if {
}(condition)
C) if {
Commands
}
D) ​if {
}
(condition){
Commands
Unlock Deck
Unlock for access to all 90 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]
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
59
Identify a method that extracts array items that match a specified condition.

A) ​sort()
B) ​filter()
C) ​splice()
D) ​reverse()
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
60
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])
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
61
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");
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
62

Identify the letter of the choice that best matches the phrase or definition.

-This method inverts the order of items in an array.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
63
JavaScript allows for the creation of _________,in which some array values are undefined.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
64
A _________ is an operator that compares the value of one expression to another returning a Boolean value indicating whether the comparison is true or not.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
65
The collection of commands that is run each time through a loop is known collectively as a _________.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
66
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;
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
67
_________ is a number associated with each individual value in an array and distinguishes each value from other values in the array.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
68
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
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
69
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);
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
70
A _________ is a set of commands executed repeatedly until a stopping condition is met.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
71

Identify the letter of the choice that best matches the phrase or definition.

-This method appends an array with new items.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
72
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 < = 29){
DayCount[2] = 29;
}
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
73
_________ is a section of an array.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
74
A _________ is a statement that runs a command or command block only when certain circumstances are met.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
75
A stack data structure employs the _________ principle in which the last items added to the stack are the first ones removed.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
76

Identify the letter of the choice that best matches the phrase or definition.

-This method removes the last item from an array.

A) array.unshift(values)
B) array.toString()
C) pop()
D) concat(array1,array2,...)
E) sort()
F) copyWithin(target,start[,end])
G) join(separator)
H) shift()
I) reverse()
J)push(values)
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
77
Identify the syntax of the statement label.

A) ​label = {statements}
B) ​statement!(label)
C) ​label: statements
D) ​statements.label
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
78
Arrays can be used to store information in a data structure known as a _________ in which new items are added to the top or to the end of the array.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
79
The _________ returns the integer remainder after dividing one integer by another.
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
80
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);
Unlock Deck
Unlock for access to all 90 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 90 flashcards in this deck.