A developer is debugging a web server that uses Node.js The server hits a runtime error every third request to an important endpoint on the web server. The developer added a break point to the start script, that is at index.js at he root of the server's source code. The developer wants to make use of chrome DevTools to debug. Which command can be run to access DevTools and make sure the breakdown is hit?
-
A
-
B
Node --inspect-brk index.js
-
C
-
D
Reveal answer details
Close answer details
Question 2
Multiple choice
What are two unique features of functions defined with a fat arrow as compared to normal function definition? Choose 2 answers
-
A
The function generated its own this making it useful for separating the function's scope from itsenclosing scope.
-
B
The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scope.
-
C
If the function has a single expression in the function body, the expression will be evaluated and implicit returned.
-
D
The function uses the this from the enclosing scope.
Reveal answer details
Close answer details
Question 3
Multiple choice
Universal Containers (UC)notices that its application that allows users to search for accounts makes a network request each time a key is pressed. This results in too many requests for the server to handle. Address this problem, UC decides to implement a debounce function on string change handler. What are three key steps to implement this debounce function? Choose 3 answers:
-
A
If there is an existing setTimeout and the search string change, allow the existing setTimeout to finish, and do not enqueue a new setTimeout.
-
B
When the search string changes, enqueue the request within a setTimeout.
-
C
Ensure that the network request has the property debounce set to true.
-
D
If there is an existing setTimeout and the search string changes, cancel the existing setTimeout using thepersisted timerId and replace it with a new setTimeout.
-
E
Store the timeId of the setTimeout last enqueued by the search string change handle.
Reveal answer details
Close answer details
A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from. Which global variable can be used in the script?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 5
Multiple choice
Refer to the following array: Let arr = [ 1,2, 3, 4, 5]; Which three options result in x evaluating as [3, 4, 5] ? Choose 3 answers.
-
A
Let x= arr.filter (( a) => (a<2));
-
B
-
C
-
D
Let x=arr.filter((a) => ( return a>2 ));
-
E
Reveal answer details
Close answer details
Refer to the code below: Let car1 = new Promise((_ , reject) => setTimeout(reject, 2000, "car 1 crashed in" => Let car2 =new Promise(resolve => setTimeout(resolve, 1500, "car 2 completed") Let car3 =new Promise(resolve =>setTimeout(resolve, 3000, "car 3 completed") Promise.race(( car1, car2, car3)) .then (value => ( Let result = `$(value) the race.';)} .catch(arr => { console.log("Race is cancelled.", err); }); What is the value of result when Promise.race executes?
-
A
-
B
Car 2 completed the race.
-
C
Car 1 crashed in the race.
-
D
Reveal answer details
Close answer details
Refer to the code below:  What is the result when the Promise in the execute function is rejected?
-
A
Resolved1 Resolved2 Resolved3 Resolved4
-
B
-
C
-
D
Rejected1 Rejected2 Rejected3 Rejected Rejected Rejected4
Reveal answer details
Close answer details
Referto the code below: Const pi = 3.1415326, What is the data type of pi?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
CORRECT TEXT Refer the following code  what is the value of array after code executes?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 10
Single choice
There is a new requirement for a developer to implement a currPrice method that will return the current price of the item or sales..  What is the output when executing the code above
-
A
50 Uncaught TypeError: saleItem,desrcription is not a function
-
B
-
C
-
D
50 Uncaught ReferenceError:this,discount is undefined
Reveal answer details
Close answer details
Question 11
Single choice
Given the following code:  What is the output of line 02?
-
A
-
B
-
C
Reveal answer details
Close answer details
Question 12
Single choice
Given the code below: Function myFunction(){ A =5; Var b =1; } myFunction(); console.log(a); console.log(b); What is the expected output?
-
A
Both lines 08 and 09 are executed, and the variables are outputted.
-
B
Line 08 outputs the variable, but line 09 throws an error.
-
C
Line 08 thrones an error, therefore line 09 is never executed.
-
D
Both lines 08 and 09 are executed, but values outputted are undefined.
Reveal answer details
Close answer details
Question 13
Multiple choice
A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an array. The developer needs to verify how many times the method was called and the arguments used each time. Which two test approaches describe the requirement? Choose 2 answers
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 14
Single choice
Which statement accurately describes an aspect of promises?
-
A
Arguments for the callback function passed to .then() are optional.
-
B
In a.then()function, returning results is not necessary since callbacks will catch the result of a previous promise.
-
C
.then() cannot be added after a catch.
-
D
.then() manipulates and returns the original promise.
Reveal answer details
Close answer details
Question 15
Single choice
Refer to the HTML below: <div id="main"> <ul> <li>Leo</li> <li>Tony</li> <li>Tiger</li> </ul> </div> Which JavaScript statement results in changing " Tony" to "Mr. T." ?
-
A
document.querySelectorAll(`$main $TONY').innerHTML = ' Mr. T. ';
-
B
document.querySelector(`$main li:second-child').innerHTML = ' Mr. T. ';
-
C
document.querySelector(`$main li.Tony').innerHTML = ' Mr. T. ';
-
D
document.querySelector(`$main li:nth-child(2)'),innerHTML = ' Mr. T. ';
Reveal answer details
Close answer details
Question 16
Single choice
Refer to the code below: Let textValue = '1984'; Which code assignment shows a correct way to convert this string to an integer?
-
A
let numberValue = Number(textValue);
-
B
Let numberValue = (Number)textValue;
-
C
Let numberValue = textValue.toInteger();
-
D
Let numberValue = Integer(textValue);
Reveal answer details
Close answer details
Question 17
Multiple choice
A developer wrote a fizzbuzzfunction 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 neither3 or 5. Which two test cases will properly test scenarios for the fizzbuzz function? Choose 2 answers
-
A
let res = fizzbuzz(5); console.assert ( res === ` ' );
-
B
let res = fizzbuzz(15); console.assert ( res === ` fizzbuzz ' )
-
C
let res = fizzbuzz(Infinity); console.assert ( res === ` ' )
-
D
let res = fizzbuzz(3); console.assert ( res === ` buzz ' )
Reveal answer details
Close answer details
Question 18
Multiple choice
A test has a dependency on database. query. During the test, the dependency is replaced with an object called database with the method, Calculator query, that returns an array. The developer does not need to verify how many times the method has been called. Which two test approaches describe the requirement? Choose 2 answers
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 19
Single choice
Teams at Universal Containers (UC) work on multiple JavaScript projects at the same time. UC is thinking about reusability and how each team can benefit from the work of others. Going open-source or public is not an option at this time. Which option is available to UC with npm?
-
A
Private packages can be scored, andscopes can be associated to a private registries.
-
B
Private registries are not supported by npm, but packages can be installed via URL.
-
C
Private packages are not supported, but they can use another package manager like yarn.
-
D
Private registries are not supported by npm, but packages can be installed via git.
Reveal answer details
Close answer details
Question 20
Single choice
Which option is a core Node,js module?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 21
Multiple choice
Refer to the following code: 01 function Tiger(){ 02 this.Type = `Cat'; 03 this.size = `large'; 04 } 06 let tony = new Tiger(); 07 tony.roar = () =>{ 08 console.log(`They\'re great1'); 09 }; 11 function Lion(){ 12 this.type = `Cat'; 13 this.size = `large'; 14 } 16 let leo = new Lion(); 17//Insert code here 18 leo.roar(); Which two statements could be inserted at line 17 to enable the function call on line 18? Choose 2 answers.
-
A
Leo.roar = () => { console.log(`They\'re pretty good:'); };
-
B
Object.assign(leo,Tiger);
-
C
-
D
Leo.prototype.roar = () => { console.log(`They\'re pretty good:'); };
Reveal answer details
Close answer details
Question 22
Multiple choice
Which two code snippetsshow working examples of a recursive function? Choose 2 answers
-
A
Let countingDown = function(startNumber) { If ( startNumber >0) { console.log(startNumber) ; return countingDown(startNUmber); } else { return startNumber; }};
-
B
Function factorial ( numVar ) { If (numVar < 0) return; If ( numVar === 0 ) return 1; return numVar -1;
-
C
Const sumToTen = numVar => { If (numVar < 0) Return; return sumToTen(numVar + 1)};
-
D
Const factorial =numVar => { If (numVar < 0) return; If ( numVar === 0 ) return 1; returnnumVar * factorial ( numVar - 1 ); };
Reveal answer details
Close answer details
Question 23
Single choice
Refer to code below: Let a ='a'; Let b; // b = a; console.log(b); What is displayed when the code executes?
-
A
ReferenceError: b is not defined
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 24
Single choice
A developer wants to set up a secure web serverwith Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js Without using any third-party libraries, what should the developer add to index.js to create the secure web server?
-
A
const https =require(`https');
-
B
const server =require(`secure-server');
-
C
const tls = require(`tls');
-
D
const http =require(`http');
Reveal answer details
Close answer details
Question 25
Multiple choice
A developer needs to test this function: 01const sum3 = (arr) => ( 02if (!arr.length) return 0, 03if (arr.length === 1) return arr[0], 04if (arr.length === 2) return arr[0]+ arr[1], 05 return arr[0] + arr[1] + arr[2], 06 ); Which two assert statements are valid tests for the function? Choose 2 answers
-
A
console.assert(sum3(1, `2')) == 12);
-
B
console.assert(sum3(0)) == 0);
-
C
console.assert(sum3(-3, 2 )) == -1);
-
D
console.assert(sum3(`hello', 2, 3, 4)) === NaN);
Reveal answer details
Close answer details
Question 26
Single choice
A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server. Which command should the developer run to start the server locally?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 27
Single choice
A developer has an is Dog function that takes one argument cat. They want to schedule the function to run everyminute. What is the correct syntax for scheduling this function?
-
A
setInterval(isDog, 60000, 'cat');
-
B
setTimeout(isDog, 60000);
-
C
setInterval(isDog('cat'), 60000);
-
D
setTimeout(isDog, 60000, 'cat');
Reveal answer details
Close answer details
Question 28
Single choice
A developer has two ways to write a function: Option A: function Monster() { This.growl = () => { Console.log ("Grr!"); } } Option B: function Monster() {}; Monster.prototype.growl =() => { console.log("Grr!"); } After deciding on an option, the developer creates 1000 monster objects. How many growl methods are created with Option A Option B?
-
A
1 growl method is created for Option A.1000 growl methods are created for Option B.
-
B
1000 growl method is created for Option A. 1 growl methods are created for Option B.
-
C
1000 growl methods are created regardless of which option is used.
-
D
1 growl method is created regardless of which option is used.
Reveal answer details
Close answer details
Question 29
Multiple choice
Refer of the string below: Const str = `sa;esforce'=; Which two statement result in the word 'Sale'? Choose 2 answers
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 30
Single choice
Given the code below: 
What is logged to the console?
-
A
4 2 1 5 3
-
B
4 1 2 5 3
-
C
4 2 5 1 3
-
D
4 5 2 1 3
Reveal answer details
Close answer details
Question 31
Single choice
Refer to HTML below: <p> The current status of an Order: <span id ="status"> In Progress </span> </p>. Which JavaScript statement changes thetext `In Progress' to `Completed' ?
-
A
document.getElementById("status").Value = 'Completed' ;
-
B
document.getElementById("#status").innerHTML = 'Completed' ;
-
C
document.getElementById("status").innerHTML = 'Completed' ;
-
D
document.getElementById(".status").innerHTML = 'Completed' ;
Reveal answer details
Close answer details
Question 32
Single choice
A developer is required to write a function that calculates the sum of elements in an array but is getting undefinedevery time the code is executed. The developer needs to find what is missing in the code below. Const sumFunction = arr => { Return arr.reduce((result, current) => { // Result += current; // ), 10); ); Which option makes the code work as expected?
-
A
Replace line 02 with return arr.map(( result, current) => (
-
B
Replace line 04 with result = result +current;
-
C
Replace line 03 with if(arr.length == 0 ) ( return 0; )
-
D
Replace line 05 with return result;
Reveal answer details
Close answer details
Question 33
Single choice
Cloud Kicks has a class to represent items for sale in an online store, as shown below: Class Item{ constructor (name, price){ this.name = name; this.price = price; } formattedPrice(){ return `s' + String(this.price);}} A new business requirement comes in that requests a ClothingItem class that should have all of the properties and methods of the Item class but will also have properties that are specific to clothes. Which line of code properly declares the clothingItem class such that it inherits from Item?
-
A
Class ClothingItem implements Item{
-
B
-
C
Class ClothingItem super Item {
-
D
Class ClothingItem extends Item {
Reveal answer details
Close answer details
Question 34
Single choice
At Universal Containers, every team has its own way of copyingJavaScript objects. The code snippet shows an Implementation from one team:  What is the output of the code execution?
-
A
-
B
-
C
-
D
SyntaxError: Unexpected token in JSON
Reveal answer details
Close answer details
|