Which of the following statements is used to terminate any program loop or conditional statement?
Front
break
Back
Identify the syntax of the while loop.
Front
while (continue) {commands}
Back
Identify the general syntax of the do/while loop.
Front
do {commands}while (continue);
Back
The slice() method reverses the order of items in an array, making the last items first and the first items last.
Front
False
Back
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.
Front
continue
Back
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.
Front
array.map(callback [, thisArg])
Back
Identify a method that inserts new items at the front of an array.
Front
unshift()
Back
The getDate() method in a calendar app returns an integer ranging from 0 (Sunday) to 6 (Saturday).
Front
False
Back
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?
Front
if (thisYear % 4 === 0) {dayCount[1] = 29;}
Back
Identify a compare function that sorts numeric values in descending order.
Front
function descending(a, b) {return b - a;}
Back
Which of the following determines the current size of an array?
Front
array.length
Back
Identify a method that tests whether the condition returned by the callback function holds for all items in an array .
Front
array.every(callback [, thisArg])
Back
Identify the general structure of a for loop.
Front
for (start;continue;update){commands}
Back
Identify the output of the following code.
var x = [3, 45, 1234, 24];
x.sort();
Front
1234, 24, 3, 45
Back
​ A(n) _____ is a collection of values organized under a single name.
Front
array
Back
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.
Front
map()
Back
Identify the expression in which the initial value of the day variable will be set to match the first day of the calendar month.
Front
var day = new Date(calDate.getFullYear(), calDate.getMonth(), 1);
Back
Identify the structure of an if statement
Front
if (condition) {commands}
Back
Identify a true statement of array .find(callback [, thisArg]) method.
Front
It returns the value of the first element in the array that passes a test in the callback function.
Back
Identify the expression used to reference array values.
Front
array[i]
Back
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;
}
Front
5, 8, 12
Back
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?
Front
if (thisYear === 2020) {dayCount[1] = 29;}
Back
Identify the syntax of the statement label.
Front
label: statements
Back
Identify a method that decreases array by keeping only those items that return a value of true from the callback function.
Front
array.reduce(callback [, thisArg])
Back
Which of the following functions increases the value of each item in an array by 1?