Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 5 What will below code print? process.on('exit', function(code) { setTimeout(function() { console.log(will setTimeout run?); }, 0); console.log('Exiting with code:', code); console.log(Process finishing); O
QUESTION 5 What will below code print? process.on('exit', function(code) { setTimeout(function() { console.log("will setTimeout run?"); }, 0); console.log('Exiting with code:', code); console.log("Process finishing"); O A. Process finishing Exiting with code: 0 OB. Nothing O c. will setTimeout run? Exiting with code: 0 Process finishing O D. Process finishing will setTimeout run? Exiting with code: 0 1 points Save Answer QUESTION 6 What will below code print? const EventEmitter = require('events'); class MyEmitter extends EventEmitter ( const myEmitter = new MyEmitter(); let m = 0; myEmitter.once('event', () => { console.log(++m); }); myEmitter.emit('event'); myEmitter.emit('event'); OA1 2 OB. 1 OC.0 O D.O 1 1 points Save Answer QUESTION 1 To expose variables and functions from a module, the following is used: O A. this.module B. module.exports O c.module.output O D. export.module 1 points Saved QUESTION 2 To get the name of the directory that the currently executing script resides in, we use: A.____dirname O B._directory O C. console.exec('pwd') O D. console.readDir('-') 1 points Saved QUESTION 9 What's the possible output of below piece of code? console.time("label1"); setTimeout(function(){ console.log("Hello after 2 seconds"); }, 2000); console.timeEnd("label1'); O A. label1: 2.001ms Hello after 2 seconds O B. label1: 0.857ms Hello after 2 seconds O C. Hello after 2 seconds label1: 0.857ms O D. Hello after 2 seconds label1: 2.001ms 1 points Save Answer QUESTION 3 What will get printed out from below code when user input 'purple' in the command line interface? const question_signal = "What light is it?" const ask question = () => { process.stdout.write(question_signal); process.stdout.write('>'); } ask question() process.stdin.once('data', (data) => { console.log("You answered '+ data) data = data.toString().trim().toLowerCase() if (data==='red') { console.log('red light, stop') } else if (data===yellow'){ console.log("yellow light, caution') } else if (data==='green'){ console.log('green light, go') } else { console.log('invalid signal") 1 points Save Answer O yellow light, caution. O invalid signal O purple light O red light, stop QUESTION 4 Which call will you make to set a four-second timer, then call the function progress() when it expires? O setTimeout(progress, 4000); O setTimeout(4, progress()); O setTimeout(progress(), 4); O setTimeout("4000", progress); 1 points Save Answer
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started