Set 1-3
Node.js Fundamentals Quiz
Test your knowledge of Node.js with this engaging quiz designed for developers!
Whether you're a beginner or a seasoned pro, challenge yourself with 10 multiple-choice questions that cover essential concepts and fun
- Core Node.js modules
- Error handling techniques
- Debugging strategies
Which option is a core Node.js module?
Locale
Path
Ios
Memory
A developer has an ctions.
ErrorHandler
module that contains multiple funWhat kind of export should be leveraged so that multiple functions can be used?
Default
Named
All
Multi
A developer has the function, shown below, that is called when a page loads.
function onLoad() {
console.log("Page has loaded!");
}
What can the developer see the log statement after loading the page in the browser?
Terminal running the web server
Browser performance tools
On the webpage
Browser JavaScript console
Refer to the code below:
let first = 'Who';
let second = 'What';
try {
try {
throw new Error('Sad trombone');
} catch(err) {
first = 'Why';
throw err;
} finally {
second = 'When';
}
} catch(err) {
second = 'Where';
}
What are the values for
first
and second
once the code executes?First is Why and second is Where
First is Who and second is Where
First is Who and second is Wen
First is Why and second is When
Refer to the code below:
01 const monthName = 'July';
02 const year = 2019;
03 if(monthName === 'July'){
04 year = 2020;
05 }
A developer receives feedback from the Tech Lead that the code gives an error.
Which line edit should the developer make so this code runs?
03 if(monthName === July){
02 const year = '2019';
02 let year = 2019;
03 if(monthName == 'July'){
A developer writes the code below to return a message to a user attempting to register a new username. If the username is available, a variable named msg is declared and assigned a value on line 03.
01 function getAvailabilityMessage(){
02 if(getAvailability(item)){
03 var msg = "Username available";
04 }
05 return msg;
06 }
What is the value of msg when getAvailabilityMessage("newUserName") is executed and getAvailability("newUserName") returns true?
Undefined
"newUserName"
"msg is not defined"
"Username available"
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.Given the code and the information the developer has, which code logs an error at boot time with an event?
01 server.error((error) => {
02 console.log('ERROR', error);
03 });
01 server.on('error', (error) => {
02 console.log('ERROR', error);
03 });
01 server.catch((error) => {
02 console.log('ERROR', error);
03 });
01 try {
02 server.start();
03 } catch(error) {
A developer wrote the following code to test a ction that takes in an array of numbers and returns the sum of the first three numbers in the array, and the test passes.
sum3
fun01 let res = sum3([1, 4, 1]);
02 console.assert(res === 6);
03
04 res = sum3([1, 5, 0, 5]);
05 console.assert(res === 6);
A different developer made changes to the behavior of
sum3
to instead sum only the first two numbers present in the array.Which two results occur when running this test on the updated
sum3
funChoose 2 anwers.
The line 05 assertion fails.
The line 05 assertion passes.
The line 02 assertion passes.
The line 02 assertion fails.
A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.
The developer wants to test the endpoint on a local machine and make the request against a local server to look at the behavior. In the source code, the server.js file will start the server. The developer wants to debug the Node.js server only using the terminal.
Which command can the developer use to open the CLI debugger in their current terminal window?
Node -i server.js
Node inspect server.js
Node start inspect server.js
Node server.js --inspect
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.
To address this problem, UC decides to implement a ction on the search string change handler.
debounce
funChoose 3 answers
Ensure that the network request has the property debounce set to true
If there is an existing setTimeout and the search string changes, allow the existing setTimeout to finish, and do not enqueue a new setTimeout
When the search string changes, enqueue the request within a setTimeout
Store the timerId of the setTimeout last enqueued by the search string change handler
If there is an existing setTimeout and the search string changes, cancel the existing setTimeout using the persisted timerId and replace it with a new setTimeout
{"name":"Set 1-3", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of Node.js with this engaging quiz designed for developers!Whether you're a beginner or a seasoned pro, challenge yourself with 10 multiple-choice questions that cover essential concepts and functionalities in Node.js.Core Node.js modulesError handling techniquesDebugging strategies","img":"https:/images/course1.png"}