HTML Tutorial 10
Which of the following values will the expression 15 % 4 return?
3
Which of the following values will the expression 15 % 4 return?
3
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; }
5, 8, 12
Identify a true statement of array.find(callback [, thisArg]) method.
It returns the value of the first element in the array that passes a test in the callback function.
Identify a true statement of array.some(callback [, thisArg]) method.
It tests whether the condition returned by the callback function holds for at least one item inarray.
Which of the following functions increases the value of each item in an array by 1?
StepUp()
Which of the following functions increases the value of each item in an array by 1?
StepUp()
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; }
[92, 95, 91]
A(n) _____ is a collection of values organized under a single name.
array
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?
array.filter(callback [, thisArg])
Identify the general syntax of the forEach method.
array.forEach(callback [, thisArg])*
Which of the following determines the current size of an array?
array.length
The _____ method diminishes array from the last element by keeping only those items that return a value of true from the callback function.
array.reduceRight(callback [, thisArg])
Identify the expression used to reference array values.
array[i]
Identify a method that inserts new items at the front of an array.
unshift()
Identify the syntax of the while loop.
while (continue) { commands}
Identify a method that tests whether the condition returned by the callback function holds for all items in an array.
array.every(callback [, thisArg])
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.
array.map(callback [, thisArg])
Identify a method that decreases array by keeping only those items that return a value of true from thecallback function.
array.reduce(callback [, thisArg])
Identify a compare function that sorts numeric values in ascending order.
function ascending(a, b) { return a - b; }
What is the output of the following code? for(var i = 5; i > 0; i--)
i = 5, 4, 3, 2, 1
Identify the syntax of the statement label.
label: statements
Identify a method that extracts array items that match a specified condition.
sort() filter() reverse()
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.
sort() map()
What is the output of the following code? var x = ["a", "b", "c"]; x.push("d", "e"); x.pop(); x.pop();
x = ["a", "b", "c"]
Which of the following statements is used to terminate any program loop or conditional statement?
break
Which of the following methods is used to determine the day of the week on which a month starts?
calDay; find.Day; getDay()
Numeric data can be sorted by creating a(n) _____ function that contrasts the values of two adjacent array items.
compare
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.
continue
Identify the general syntax of the do/while loop.
do {commands} while (continue);
The _____ loop tests the condition to continue the loop right after the latest command block is run.
do/while
Identify a compare function that sorts numeric values in descending order.
function descending(a, b) { return b - a;}
Which of the following methods is used to determine the day of the week on which a month starts?
getDay()
What is the output of the following code?for (var i = 0; i <= 360; i+=60)
i = 0, 60, 120, 180, 240, 360
Identify the structure of an if statement
if (condition) { commands}
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.
queue
Identify a method that inserts new items at the front of an array.
reverse() unshift() sort()
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.
shift()
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.
shift()
Identify a method that is used to create a subarray.
slice()
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.
sort() map() splice()
Identify the general structure of a for loop.
for (start;continue;update){commands}
Identify the general structure for accessing each value from an array using a for loop.
for (var i = 0; i < array.length; i++) { commands involving array[i]}
Identify the output of the following code. var x = [3, 45, 1234, 24]; x.sort();
1234, 24, 3, 45 1234, 24, 45
The _____ operator tests whether two items are equal in value and have the same data type.
===
Identify the expression in which the initial value of the day variable will be set to match the first day of the calendar month.
var day = new Day(calDate.getDD(), calDate.getMM(),calDate.getYY(),1); var day = new Date(calDate.getFullYear(), calDate.getMonth(), 1);
Which of the following examples tests whether x is equal to 5 or y is equal to 8?
(x === 5) || (y === 8)
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; }
22