Adblocker Detected
Quizack provides Online Quiz and Practice MCQs for Free. Please disable your Ad-Blocker so we can earn from ads and keep this project alive.
1. Which coice is a core module in Node?
2. When exploring the Node documentation's features, what are the stability ratings?
3. How can ECMAScript modules be used natively in Node?
4. What is the importance of having good practices around status code in your response?
5. What is used for parsing and running Javascript in Node.js?
6. How does it affect the performance of a web application when an execution path contains a CPU-heavy operation, such as calculating a long Fibonacci sequence?
7. What is Node built on?
8. Which choice is not a subclass of the Error class?
9. Which choice is not a method on the util module?
10. Which assert module method is usually used to test the error-first argument in callbacks?
11. Is it possible to write tests in Node.js without an external library?
12. What is a process object and its role?
13. What is the purpose of N-API?
14. How can you convert path segments into a string using the platform-specific separator as a delimiter?
15. What is the correct way to pipe a readable stream and a writable stream?
16. Which choice is not a Node global object?
17. You have to read a large text file, replace some words in it, and write it back to a new file. You know that the memory on your target system is limited. What should you do?
18. How would you determine the number of cluster instances to start when using the cluster module?
19. Which core module in Node can you use to compile and run JavaScript code in a sandbox environment?
20. Which statement about event emitters is false?
21. Which statement is true about Node.js and threads?
22. Which global object acts like a bridge between a Node script and the host operating system?
23. Which Node.js module should you use when you need to decode raw data into strings?
24. Which core module in Node provides an API to register callbacks to track asynchronous resources created inside a Node.js application?
25. Which core module in Node can you use for testing?
26. Which file does node-gyp use to read the build configuration of a module?
27. What does REPL stand for?
28. According to the rules of semantic versioning, what does a release incrementing the third number in an npm version string communicate to users about the release changes?
29. Which line imports a promise-based version of the readFile method?
30. Which core Node module has wrappers for OpenSSL methods?
31. Which core module in Node can you use to take advantage of multicore systems?
32. What can you export with module.exports?
33. What does the .node file extension represent?
34. Which library provides Node.js with the event loop?
35. What are the arguments passed to the module wrapper function?
36. When a request event is received in the HTTP module, what is the type of the first argument passed to that event, usually named req?
37. What is the command to get a list of available commands for Node.js?What is the command to get a list of available commands for Node.js?
38. Which special object is an instance of EventEmitter?Which special object is an instance of null?
39. Which choice is not a valid method on event emitters?
40. You have a script.js file with the single line of code shown here. What will be the output of executing script.js with the node command? console.log(arguments);
41. Which of the following is NOT a valid stream in Node?
42. What is the Node LTS version?
43. What is the purpose of the file system (fs) module?
44. How do you start a Node application, if the entry file is indexjs?
45. How do you make an HTTP server object active and listen to requests on certain ports?
46. What is the purpose of the path module?
47. When you run JavaScript in a Node.js application, which of the following elements in a Node.js stack actually executes that JavaScript?
48. Which console method can be used to print the stack trace to the point of its execution?
49. If the child_process module methods are in scope, what is a current way to execute the command ps -ef using a child process?
50. Which module variable holds the resolved absolute path of the current module file?
51. Which of the following objects is a stream
52. If EventEmitter is in scope, which of the following lines of code will have an event emitter emitting a change event?
53. Which statement is true when you run the code shown below? require('child_process').fork('script.js');
54. Which of the following is NOT a Node repl command?
55. How can you use the promise API with a callback-based function such as child_process.exec?
56. What is the command to silence all process warnings?
57. Which object is used to manage the cache of required modules?
58. Which of the following is a method on the console object?
59. How can you count the number of logical CPUs on the machine that is running Node?
60. Which CLI option can you use to debug a node script in Chrome DevTools?
61. What is the Api that is designed to insulate Addons from changes in the underlying JavaScript engine?
62. Can you create an https web server with Node.js?
63. How do you check that a value is a date object in Node?
64. Which of the following DNS module methods uses the underlying OS facilities and does not necessarily perform any network communication?
65. Which fs module method can be used to read the content of a file without buffering it in memory?
66. Which of the following modules is NOT a built-in module in Node?
67. Which of the following Buffer class methods returns an uninitialized buffer?
68. Which of the following is a core module in Node?
69. When a javaScript function is invoked (called) in Node, where is a new frame placed?
70. The given program should generate the following output:{value1: 2222, value2: [ x: 'hello Worldl', y: 8888 ]]However, the program contains errors. Identify which of the given lines of code contain errors.Program 1. var firstvar =[ 2. value1: 2222, 3. value2: { 4. xz‘hello World!’ 5. y: 8888 6-]; 7. }; 8. console.log(firstvar);
71. Which of the following statements is/are correct about working with the MongoDB server and the Mongodb module?
72. Carefully study the code snippet given in the image and determine which of the following lines of code contain errors.
73. Carefully study the following Node.js code snippet and answer the question that follows. 1. var var1 =( 2. xz50. 3. y :'This is a string', 4. z : false 5. ]; 6. varjson_example = stringify.JSON(var1); 7. console.log(json_example); 8. console.log(typeofjson_example ); 9. var json_example1 = JSON.parse(var1); 10. console.log(json_example1); 11. console.log(json_example1.y) Which of the following lines of code contain an error?
74. The given program should generate the following output: The values are: [ [ Value: 15 }, [Value: 8 }]However, the program contains some errors. Identify which code lines contain an error. 1) function addValue(val1. va|2)[ 2) setTimeout(function(){ 3) val2(null. [Value: val1]); 4) ), 500); 5)] 6) function valuesLoaded (loadedVaIues){ 7) console.log(‘The values are:'. loadedVaIues); 8)]< 9) var a = require(Async); 10) a.parallel([function(val) [ 11) addValue(15, val); 12) l. 13) function(val)[ 14) addValue(val, 8); 15)] 16) ],valuesLoaded)
75. Which two of the following statements will generate the output 'Hello Node.js'?
76. Which of the following statements are NOT true about promises in Node.js?
77. Which of the following is/are not (a) valid state(s) of promise used in Node.js?
78. A Node.js application consists of an HTML file named ‘idx.html' and a JavaScript file 'ht3.js'. The file ht3.js when executed, should display the content of 'idx.html' file on the web browser. However, the file 'ht3.js' contains some errors. Identify which code lines contain an error. 1. var http = require(‘http'); 2. var fs; 3. function send404(response){ 4. response.writeHead(404. ['Content—Type' :‘text/plain'}); 5. response.write('Error 404: Resource not found'); 6. response.end0: 7. } 8. var server =http.createServer(function(req. res)[ 9. if(req.method = 'GET', req.url =‘/')[ 10. res.writeHead(200, ['content-type' : 'text/html'}); 11. fs.createReadStream('idx.html') 12. ] 13. else[ 14. send404fres); 15. ] 16. ]).listen(3000); 17. console.logf'server running on port 3000');
79. The following program was designed to create an Express app that displays the output 'Working with Express' on the web browser. But the program contains some errors. Identify which code lines contain an error. 1) var exp1= require('express'); 2) var http: require('http‘); 3) var newapp = exp1() 4) use(function(req. res. next) [ 5) res.end('Working with Express'); 6) i): 7) https.createServer(newapp).listen(3000);
80. Which of the following classes is/are always used for connecting to a MongoDB server?
81. The program given in the image should create a web page with a simple label 'Enter name', a text-box and a button. Initially, the text-box should display 'NAME' as its content. The content of the text-box should be cleared each time the button is clicked. However, the program contains some errors. Identify which code lines contain an error.
82. What will be the output of the following code snippet in Node.js? var x = 2.4; var y = 9; console.log(y/x)
83. Carefully study the following code snippet and answer the question that follows: new_function (true, function (data){ func1(); }); func2(); function func1(){console.log('Clouds')} function func2(){console.log('Sunshine')} function new_function (ar1, ar2) { if (ar1) { ??? } else { setTimeout(function () { ar2() }, 1000); } } Which of the given code lines should be written in place of '???' in the above program so that the following output is obtained?
84. In a Node.js application, the 'optimist' module is installed. If the following program is executed in a JavaScript file of this application, then what will be the output?var a1 = require('optimist').argv;delete a1['$0'];console.log(a1);
85. A Node.js project consists of three files: app1.js, app2.js, and app3.js. The code snippets of each of these files are given below. If we execute app2.js, then what output will be obtained? app1.js module.exports = {value1: 'Hello'}app2.jsvar app1 = require('./app1');console.log('Initial value:',app1.value1);app1.value1 = 'World';var app3 = require('./app3');app3.jsvar app3 = require('./app2');console.log('Final value:', app3.value1);
86. In the following program of an asynchronous test, which line of code contains an error? Line 1: exportsaynchabc = function (abc)[ Line 2: setTimeout(function (){ Line 3: abc.equal(false, true); Line 4: abc.done(true. false); Line 5: } 1200); Line 6: };
87. What will be the output of the following code snippet? var x =[8, 12, 3]; x.push(5); x.unshift(1); console.log(x[0]);
88. In Node.js, which of the following functions is used by an Express app to accept the middleware?
89. Carefully read the following code: 1. var EventEmitter = require('events').EventEmitter; 2. var example = new EventEmitter(); 3. example.on('data', function sample1(){}); 4. example.on('data', function sample2(){}); 5. console.log(???); Which of the given options should replace ??? in line 5 of the above-given code snippet to obtain the following output? [ [Function: sample1], [Function: sample2] ]
90. Consider two files: first.js and second.js in a Node.js project. Content of the first.js file is given as: module.exports = function() { console.log('function in file first'); Which of the following lines of code should be written in the second.js file in order to import the function given in the first.js file to the second.js file?
91. Which of the following is the purpose of installing the NPM module, optimist?
92. Which of the following operators checks whether the given field is an array and contains all the values in the given array of values or not?
93. State if true or false. In node.js, applications are processed asynchronously on a single thread.
94. Which of the following command line arguments can be used to convert a file named 'base3.js' into an AMD module?
95. What will be the output of the following program?var name = 'John';var dob = 15;console.log('%s was born on %d May, 1987', name, dob)
96. Choose True or False. In MongoDB, it is possible to insert two values with same_id values into a collection.
97. What will be the output of the following Node.js code snippet? var EventEmitter = require('events').EventEmitter; Var er = new EVentEmitter(); var handler1 = function () { console.log('Called the handler'); er.removeListener('example', handler1); }; er.on('example', handler1); er.emit('example'); er.emit('example');
98. Which of the following is/are true about the http.ServerResponse object in Node.js? 1. It is created by an HTTP server. 2. It is passed as first parameter to the 'request' event. 3. It is a writable stream.
99.
Suppose we have the following code in a Node.js file.
var path = require('path');
var completePath ='lexample/test/firsthtml';
Which of the following lines of code should be added to the above code so that the output 'first.html' is displayed?
100. What output will be generated on the execution of the following code snippet in Node.js? function Test() {} console.log(Test.prototype.constructor === Test);
Data Mining
Internet Security
iOS Technical Test
Perl
SAP
Windows Phone Development
Related MCQ's