Question 21
A Developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three number in the array, The test passes:
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
console.assert(res=== 6);
A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ?
Choose 2 answers
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
console.assert(res=== 6);
A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ?
Choose 2 answers
Question 22
A developer has an ErrorHandler module that contains multiple functions.
What kind of export be leverages so that multiple functions can beused?
What kind of export be leverages so that multiple functions can beused?
Question 23
A developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality. The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.
Which code logs an error at boot time with an event?
Which code logs an error at boot time with an event?
Question 24
Given the JavaScript below:
function onLoad() {
console.log("Page has loaded!");
}
Where can the developer see the log statement after loading the page in the browser?
function onLoad() {
console.log("Page has loaded!");
}
Where can the developer see the log statement after loading the page in the browser?
Question 25
A developer has a fizzbuzz function that, when passed in a number, returns the following:
- 'fizz' if the number is divisible by 3.
- 'buzz' if the number is divisible by 5.
- 'fizzbuzz' if the number is divisible by both 3 and 5.
- empty string if the number is divisible by neither 3 or 5.
Which two test cases properly test scenarios for the fizzbuzz function?
Choose 2 answers
- 'fizz' if the number is divisible by 3.
- 'buzz' if the number is divisible by 5.
- 'fizzbuzz' if the number is divisible by both 3 and 5.
- empty string if the number is divisible by neither 3 or 5.
Which two test cases properly test scenarios for the fizzbuzz function?
Choose 2 answers
