QUESTION 5 What will below code print? process.on('exit', function(code) { setTimeout(function() { console.log(will setTimeout run?); },...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
How does the accounting equation change when a company issues stock?
-
Data set Theory Assume an informational record with one association parent including matches (a, b) where a can't try not to be a parent of b. (a) Write a Datalog demand which gives the graph of...
-
1-Calculate amount of secondary compression in terms of inches 10 years following end of the primary consolidation. S.sc ang (12)= Coefficient of secondary compression=0.035 Thickness of clay layer-...
-
The board of directors of Circuits Plus authorizes the issue of $9,000,000 of 8%, 25-year bonds payable. The semiannual interest dates are May 31 and November 30. The bonds are issued on May 31,...
-
Draft Company purchased 14,000 shares of Hamburg Corporation's 40,000 shares of common stock on January 1. This represented 35% of Hamburg's outstanding shares and gave Draft Company significant...
-
Investigate a California case in which a stakeholders right to interpleader was revoked by the court. Under what basis did the court deny the interpleader action?
-
A closed curve encircles several conductors. The line integral ф B.d1 around this curve is 3.83 X l0-4 T.m. (a) What is the net current in the conductors? (b) If you were to integrate around...
-
The limit (6+ h)2-36 lim h0 h is the standard expression defining the derivative of some function f(x) at some number a. Find f and a. f(x) = a =
-
Determine expressions for the mean residence time given "outward" diffusional release into a perfect sink from a) A cylindrical monolithic device of radius a, with ends capped. b) A spherical device...
-
Which of the following is NOT a required disclosure with respect to shares? Number of shares outstanding Number of shares authorized Number of shares issued Number of shares owned
-
Castor Corporation produces three products, and is currently facing a labor shortage - only 4,800 hours are available this month. The selling prices, costs, labor requirements, and demand of the...
-
How do hybrid genres, such as the blending of science fiction and fantasy, impact traditional narrative structures, and what does this suggest about evolving reader expectations in contemporary...
-
what ways have modernist experiments with form, such as fragmented narratives and non-linear timelines, influenced contemporary storytelling across various genres ?
-
A hacker's 'dictionary' contains 900,000 passwords which have been sold to her on the dark web. She also has gained knowledge of 300,000 usernames for a particular target site. She is going to try...
-
Green Thumb, Inc. had 1 8 , 0 0 0 shares of common stock outstanding on January 1 . An additional 6 , 0 0 0 shares were issued on May 1 . The company also had 1 , 0 0 0 shares of 5 . 5 % , $ 1 0 0...
-
A new shopping mall is being built, and management is determining which stores the mall should include. The total amount of space available for the mall is 55000 square feet. Management has decided...
-
PC Contractors, Inc., was an excavating business in Kansas City, Missouri. Union Bank made loans to PC, subject to a perfected security interest in its equipment and other assets, including...
-
John Fuji (age 37) moved from California to Washington in December 2011. He lives at 468 Cameo Street, Yakima, WA 98901. John's Social Security number is 571-78-5974 and he is single. His earnings...
-
Leslie and Leon Lazo are married and file a joint return for 2012. Leslie's Social Security number is 466-47-3311 and Leon's is 467-74-4451. They live at 143 Snapdragon Drive, Reno, NV 82102. For...
-
Kathy Kennedy (age 44) is a single taxpayer and she lives at 212 North Pine Way, Payson, AZ 85541. Her Social Security number is 467-98-9784. Kathy's earnings and income tax withholding as the...
-
Does statelessness exist in wealthy countries such as the United States? How does the status of the "Dreamers" (people who entered the United States illegally as young children) compare with that of...
-
What are the main characteristics of the various systems of social differentiation within egalitarian and rank societies?
-
How does political organization relate to social differentiation?
Study smarter with the SolutionInn App