MCQs > IT & Programming > Node.js MCQs > Basic Node.js MCQs

Basic Node.js MCQ

1. Which coice is a core module in Node?

Answer

Correct Answer: Crypto

Note: This Question is unanswered, help us to find answer for this one

2. When exploring the Node documentation's features, what are the stability ratings?

Answer

Correct Answer: They are an indication of the stability of Nodejs modules and usage recommendations.

Note: This Question is unanswered, help us to find answer for this one

3. How can ECMAScript modules be used natively in Node?

Answer

Correct Answer: ECMAScript modules cannot be used natively in Node.

Note: This Question is unanswered, help us to find answer for this one

4. What is the importance of having good practices around status code in your response?

Answer

Correct Answer: It contains information about the current performance of the server.

Note: This Question is unanswered, help us to find answer for this one

5. What is used for parsing and running Javascript in Node.js?

Answer

Correct Answer: Google V8

Note: This Question is unanswered, help us to find answer for this one

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?

Answer

Correct Answer: The current thread will block until the executon is completed and the operating system will spawn new threads to handle incoming requests. This can exhaust the number of allowed threads (255) and degrade performance over time.

Note: This Question is unanswered, help us to find answer for this one

7. What is Node built on?

Answer

Correct Answer: V8 JavaScript engine

Note: This Question is unanswered, help us to find answer for this one

8. Which assert module method is usually used to test the error-first argument in callbacks?

Answer

Correct Answer: IfError

Note: This Question is unanswered, help us to find answer for this one

9. Is it possible to write tests in Node.js without an external library?

Answer

Correct Answer: Yes, through the assert module

Note: This Question is unanswered, help us to find answer for this one

10. What is a process object and its role?

Answer

Correct Answer: A global object that provides information about the current node process

Note: This Question is unanswered, help us to find answer for this one

11. What is the purpose of N-API?

Answer

Correct Answer: To insulate Addons from changes in the underlying JavaScript engine

Note: This Question is unanswered, help us to find answer for this one

12. How can you convert path segments into a string using the platform-specific separator as a delimiter?

Answer

Correct Answer: Path.join

Note: This Question is unanswered, help us to find answer for this one

13. What is the correct way to pipe a readable stream and a writable stream?

Answer

Correct Answer: ReadableStream.pipe(writableStream)

Note: This Question is unanswered, help us to find answer for this one

14. Which choice is not a Node global object?

Answer

Correct Answer: Buffer

Note: This Question is unanswered, help us to find answer for this one

15. 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?

Answer

Correct Answer: Use readline together with streams to read and transform and write the file contents line by line.

Note: This Question is unanswered, help us to find answer for this one

16. How would you determine the number of cluster instances to start when using the cluster module?

Answer

Correct Answer: Const numInstances = require('os').cpus().length;

Note: This Question is unanswered, help us to find answer for this one

17. Which core module in Node can you use to compile and run JavaScript code in a sandbox environment?

Answer

Correct Answer: Vm

Note: This Question is unanswered, help us to find answer for this one

18. Which statement about event emitters is false?

Answer

Correct Answer: Event names must be camelCase strings.

Note: This Question is unanswered, help us to find answer for this one

19. Which statement is true about Node.js and threads?

Answer

Correct Answer: The event loop is single-threaded, but a JavaScript VM can use multiple threads.

Note: This Question is unanswered, help us to find answer for this one

20. Which global object acts like a bridge between a Node script and the host operating system?

Answer

Correct Answer: Process

Note: This Question is unanswered, help us to find answer for this one

21. Which Node.js module should you use when you need to decode raw data into strings?

Answer

Correct Answer: String_decoder

Note: This Question is unanswered, help us to find answer for this one

22. Which core module in Node provides an API to register callbacks to track asynchronous resources created inside a Node.js application?

Answer

Correct Answer: Async_hooks

Note: This Question is unanswered, help us to find answer for this one

23. Which core module in Node can you use for testing?

Answer

Correct Answer: Assert

Note: This Question is unanswered, help us to find answer for this one

24. Which file does node-gyp use to read the build configuration of a module?

Answer

Correct Answer: Binding.gyp

Note: This Question is unanswered, help us to find answer for this one

25. What does REPL stand for?

Answer

Correct Answer: Read, eval, print, loop

Note: This Question is unanswered, help us to find answer for this one

26. 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?

Answer

Correct Answer: Changes are just bug fixes and no new features were added.

Note: This Question is unanswered, help us to find answer for this one

27. Which line imports a promise-based version of the readFile method?

Answer

Correct Answer: Const { readFile } = require(fs).promises

Note: This Question is unanswered, help us to find answer for this one

28. Which core Node module has wrappers for OpenSSL methods?

Answer

Correct Answer: Crypto

Note: This Question is unanswered, help us to find answer for this one

29. Which core module in Node can you use to take advantage of multicore systems?

Answer

Correct Answer: Cluster

Note: This Question is unanswered, help us to find answer for this one

30. What can you export with module.exports?

Answer

Correct Answer: Functions, objects, arrays, or anything you assign to the module

Note: This Question is unanswered, help us to find answer for this one

31. What does the .node file extension represent?

Answer

Correct Answer: A C++ Addon file that is built with node-gyp

Note: This Question is unanswered, help us to find answer for this one

32. Which library provides Node.js with the event loop?

Answer

Correct Answer: Libuv

Note: This Question is unanswered, help us to find answer for this one

33. What are the arguments passed to the module wrapper function?

Answer

Correct Answer: Exports, require, module, __filename, __dirname

Note: This Question is unanswered, help us to find answer for this one

34. 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?

Answer

Correct Answer: Node -h

Note: This Question is unanswered, help us to find answer for this one

35. Which choice is not a valid method on event emitters?

Answer

Correct Answer: Start

Note: This Question is unanswered, help us to find answer for this one

36. 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);

Answer

Correct Answer: An object representing an array that has five elements

Note: This Question is unanswered, help us to find answer for this one

37. Which of the following is NOT a valid stream in Node?

Answer

Correct Answer: Process. stdinfo

Note: This Question is unanswered, help us to find answer for this one

38. What is the Node LTS version?

Answer

Correct Answer: It is the safest version for long-term support.

Note: This Question is unanswered, help us to find answer for this one

39. What is the purpose of the file system (fs) module?

Answer

Correct Answer: To provide methods to work with files

Note: This Question is unanswered, help us to find answer for this one

40. How do you start a Node application, if the entry file is indexjs?

Answer

Correct Answer: Node index.js

Note: This Question is unanswered, help us to find answer for this one

41. How do you make an HTTP server object active and listen to requests on certain ports?

Answer

Correct Answer: Server.listen

Note: This Question is unanswered, help us to find answer for this one

42. What is the purpose of the path module?

Answer

Correct Answer: To provide utilities to play with file and directory paths

Note: This Question is unanswered, help us to find answer for this one

43. When you run JavaScript in a Node.js application, which of the following elements in a Node.js stack actually executes that JavaScript?

Answer

Correct Answer: The VM (like VS or Chakra)

Note: This Question is unanswered, help us to find answer for this one

44. Which console method can be used to print the stack trace to the point of its execution?

Answer

Correct Answer: Trace

Note: This Question is unanswered, help us to find answer for this one

45. If the child_process module methods are in scope, what is a current way to execute the command ps -ef using a child process?

Answer

Correct Answer: Exec(

Note: This Question is unanswered, help us to find answer for this one

46. Which module variable holds the resolved absolute path of the current module file?

Answer

Correct Answer: __filename

Note: This Question is unanswered, help us to find answer for this one

47. If EventEmitter is in scope, which of the following lines of code will have an event emitter emitting a change event?

Answer

Correct Answer: EventEmitter.emit('change');

Note: This Question is unanswered, help us to find answer for this one

48. Which statement is true when you run the code shown below? require('child_process').fork('script.js');

Answer

Correct Answer: The forked process will have its own VM instance.

Note: This Question is unanswered, help us to find answer for this one

49. How can you use the promise API with a callback-based function such as child_process.exec?

Answer

Correct Answer: Util.promisify(child_process.exec)

Note: This Question is unanswered, help us to find answer for this one

50. What is the command to silence all process warnings?

Answer

Correct Answer: Node --no-warnings

Note: This Question is unanswered, help us to find answer for this one

51. Which object is used to manage the cache of required modules?

Answer

Correct Answer: Require.cache

Note: This Question is unanswered, help us to find answer for this one

52. Which of the following is a method on the console object?

Answer

Correct Answer: Time

Note: This Question is unanswered, help us to find answer for this one

53. How can you count the number of logical CPUs on the machine that is running Node?

Answer

Correct Answer: Node -p

Note: This Question is unanswered, help us to find answer for this one

54. Which CLI option can you use to debug a node script in Chrome DevTools?

Answer

Correct Answer: --inspect

Note: This Question is unanswered, help us to find answer for this one

55. What is the Api that is designed to insulate Addons from changes in the underlying JavaScript engine?

Answer

Correct Answer: N-API

Note: This Question is unanswered, help us to find answer for this one

56. Can you create an https web server with Node.js?

Answer

Correct Answer: Yes, with the https or http2 modules

Note: This Question is unanswered, help us to find answer for this one

57. How do you check that a value is a date object in Node?

Answer

Correct Answer: Util.types.isDate(value)

Note: This Question is unanswered, help us to find answer for this one

58. Which of the following DNS module methods uses the underlying OS facilities and does not necessarily perform any network communication?

Answer

Correct Answer: Lookup

Note: This Question is unanswered, help us to find answer for this one

59. Which fs module method can be used to read the content of a file without buffering it in memory?

Answer

Correct Answer: CreateReadStream

Note: This Question is unanswered, help us to find answer for this one

60. Which of the following modules is NOT a built-in module in Node?

Answer

Correct Answer: Ftp

Note: This Question is unanswered, help us to find answer for this one

61. Which of the following Buffer class methods returns an uninitialized buffer?

Answer

Correct Answer: AllocUnsafe

Note: This Question is unanswered, help us to find answer for this one

62. Which of the following is a core module in Node?

Answer

Correct Answer: Crypto

Note: This Question is unanswered, help us to find answer for this one

63.

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 f‌irstvar =[

2. value1: 2222,

3. value2: {

4. xz‘hello World!’

5. y: 8888

6-];

7. };

8. console.log(firstvar);

Answer

Correct Answer:

El Line 5



Note: This Question is unanswered, help us to find answer for this one

64. Which of the following statements is/are correct about working with the MongoDB server and the Mongodb module?

Answer

Correct Answer: III The [w: 0] f‌lag is passed to the database constructor that tells to wait until at least one conf‌irmed write has succeeded.
The Mongodb module allows multiple people to work with the database server at the same time.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

65. Carefully study the code snippet given in the image and determine which of the following lines of code contain errors.

Answer

Correct Answer: [Fl Line1
Ll Line 4

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

66.

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?


Answer

Correct Answer:

Line 6


Note: This Question is unanswered, help us to find answer for this one

67.

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)

Answer

Correct Answer:

11


Note: This Question is unanswered, help us to find answer for this one

68. Which two of the following statements will generate the output "Hello Node.js"?

Answer

Correct Answer: console.log(

Note: This Question is unanswered, help us to find answer for this one

69. Which of the following is/are not (a) valid state(s) of promise used in Node.js?

Answer

Correct Answer: Fulf‌illed

Note: This Question is unanswered, help us to find answer for this one

70.

A Node.js application consists of an HTML file named ‘idx.html' and a JavaScript f‌ile 'ht3.js'. The f‌ile ht3.js when executed, should display the content of 'idx.html' file on the web browser. However, the f‌ile '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');


Answer

Correct Answer:

14


Note: This Question is unanswered, help us to find answer for this one

71.

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);

Answer

Correct Answer:

III Line 7



Note: This Question is unanswered, help us to find answer for this one

72. Which of the following classes is/are always used for connecting to a MongoDB server?

Answer

Correct Answer: Db
Connection

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

73.

The program given in the image should create a web page with a simple label "Enter name", a text-boxand a button. Initially, the text-box should display "NAME" as its content. The content of the text-boxshould be cleared each time the button is clicked. However, the program contains some errors. Identifywhich code lines contain an error.

Answer

Correct Answer:

14 & 15



Note: This Question is unanswered, help us to find answer for this one

74.

What will be the output of the following code snippet in Node.js?

var x = 2.4;

var y = 9;

console.log(y/x)


Answer

Correct Answer:

3.75


Note: This Question is unanswered, help us to find answer for this one

75.

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?

Answer

Correct Answer:

(function (){

ar2();

}); 



process.nextTick(function () {

ar2();

});  



Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

76.

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);

Answer

Correct Answer:

Initial value: Hello

Final value: undef‌ined 



Note: This Question is unanswered, help us to find answer for this one

77.

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: };


Answer

Correct Answer:

Line 5


Note: This Question is unanswered, help us to find answer for this one

78.

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]);


Answer

Correct Answer:

1


Note: This Question is unanswered, help us to find answer for this one

79. In Node.js, which of the following functions is used by an Express app to accept the middleware?

Answer

Correct Answer: use

Note: This Question is unanswered, help us to find answer for this one

80.

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] ]

Answer

Correct Answer:

example.listeners('data') 


Note: This Question is unanswered, help us to find answer for this one

81.

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?

Answer

Correct Answer:

var x = require('./first');

x();  



Note: This Question is unanswered, help us to find answer for this one

82. Which of the following is the purpose of installing the NPM module, optimist?

Answer

Correct Answer: It exports an object that contains the parsed command line argument in the form of argv property.

Note: This Question is unanswered, help us to find answer for this one

83. Which of the following operators checks whether the given f‌ield is an array and contains all the values in the given array of values or not?

Answer

Correct Answer: $all

Note: This Question is unanswered, help us to find answer for this one

84.

State if true or false.

In node.js, applications are processed asynchronously on a single thread.


Answer

Correct Answer:

True 


Note: This Question is unanswered, help us to find answer for this one

85. Which of the following command line arguments can be used to convert a file named "base3.js" into an AMD module?

Answer

Correct Answer: browserify base3.js -o amdmodule.js

Note: This Question is unanswered, help us to find answer for this one

86.

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)


Answer

Correct Answer:

John was born on 15 May, 1987 


Note: This Question is unanswered, help us to find answer for this one

87.

Choose True or False.


In MongoDB, it is possible to insert two values with same_id values into a collection.

Answer

Correct Answer:

False 


Note: This Question is unanswered, help us to find answer for this one

88.

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');

Answer

Correct Answer:

Called the handler


Note: This Question is unanswered, help us to find answer for this one

89.

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 f‌irst parameter to the "request" event.

3. It is a writable stream.

Answer

Correct Answer:

Only1 and 3 


Note: This Question is unanswered, help us to find answer for this one

90.

Suppose we have the following code in a Node.js f‌ile.

var path = require("path");

var completePath ='lexample/test/f‌irsthtml';

Which of the following lines of code should be added to the above code so that the output 'f‌irst.html' is displayed?

Answer

Correct Answer:

console.log(path.basename(completePath));


Note: This Question is unanswered, help us to find answer for this one

91.

What output will be generated on the execution of the following code snippet in Node.js?

function Test()

{}

console.log(Test.prototype.constructor === Test);


Answer

Correct Answer:

true 


Note: This Question is unanswered, help us to find answer for this one

92.

Carefully study the given code that is calling the loadJSON method and answer the question that follows.

loadJSON("new.json", function (err, data)

{ if(err)console.log("Error in file reading", err.message);

else

console.log(data);

});

Which of the following is the correct function definition of the loadJSON method such that if a file named "neW.json" is present in the project, then its data is displayed, otherwise error message (error in file reading) is displayed?

Answer

Correct Answer:

var file1 = require('fs');

function loadJSON(file_name, arg){

file1.readFile(file_name, function(error1, data){

if(error1)return arg(error1);

try{

var new_parse =JSON.parse(data); }

catch(error1) {

return arg(error1); }

return arg(null, new_parse);

}); }



Note: This Question is unanswered, help us to find answer for this one

93.

What output will be generated when the following statements are executed in Node.js?

var x = H;

console.log(x);

x.value = 55;

console.log(x);


Answer

Correct Answer:

[]

[value: 55]  



Note: This Question is unanswered, help us to find answer for this one

94.

What will be the output of the following Node.js program?

function first (value1, value2){

console.log("First Process");

setTimeout(value2, 1000, value1);

}

function second (value1, value2){

console.log("Second Process");

setTimeout( value2, 1000, value1); }

function third (value1, value2){

console.log("Third Process");

setTimeout( value2, 1000, value1); }

function handleThird(data3){

console.log("Complete:", data3); }

function handleSecond(data2) {

third(data2, handleThird); }

function handleFirst(data1) {

third(data1, handleSecond); }

first("Process", handleThird);


Answer

Correct Answer:

First Process

Complete: Process 



Note: This Question is unanswered, help us to find answer for this one

95. Which of the following is the correct purpose of using the "exports" keyword in Node.js?

Answer

Correct Answer: It is used for exposing functions of one module to other modules.

Note: This Question is unanswered, help us to find answer for this one

96.

Which of the following is the correct program code that repeatedly calls a function after every two seconds for continuous eight seconds. and after that clears the interval with the message "Loop ends" and exits the application?

Answer

Correct Answer:

var count = 0;


var obj1 =setlnterval(function(){


count++;


console.log(count, '2 seconds has passed‘);

if(count = 4) [


console.log('Loop ends');


clearlnterval(obj1); ]


},2000); 



Note: This Question is unanswered, help us to find answer for this one

97. Which of the following is the correct command that is used to check the installed version of Node.js on Windows operating system using the C command prompt?

Answer

Correct Answer: node --version

Note: This Question is unanswered, help us to find answer for this one

98.

The following function belongs to which of the given http.Server events in Node.js:

function (request, socket, head){}


Answer

Correct Answer:

upgrade 


Note: This Question is unanswered, help us to find answer for this one

99.

Which of the following are the advantages of node_module?


a) It increases reusability.

b) It simplifies : ies the long f‌ile relative paths.

c) It helps in overcoming module incompatibility.

d) It is very helpful in changing of URLs without updating the middleware.

e) It allows to check the class of a particular object instance.


Answer

Correct Answer:

Only a, b, and c


Note: This Question is unanswered, help us to find answer for this one

100. If you generate a private key named "key.pem", then which of the following commands will be used to generate a corresponding public key?

Answer

Correct Answer: openssl req ~x509 -new -key key.pem > cert.pem

Note: This Question is unanswered, help us to find answer for this one

101. Which of the following is the correct command for installing the NPM module, underscore?

Answer

Correct Answer: npm install underscore

Note: This Question is unanswered, help us to find answer for this one

102.

Which of the given statements is correct about the following program?

function mSync (ar1, ar2) {

if (ar1){

ar2("Data Cached") }

else {

setTimeout(function () {

ar2("Data Loaded ")

}, 2000);

} }

mSync(true, function (value) {

prg1();

});

prg2();

function prg2(){console.log("Good Morning")}

function prg1(){console.log("Good Evening")}


Answer

Correct Answer:

It will immediately display the following output:

Good Evening

Good Morning 



Note: This Question is unanswered, help us to find answer for this one

103. What is the default port number on which a node process in debug mode listens for accepting the incoming connections for the purpose of debugging?

Answer

Correct Answer: 5858

Note: This Question is unanswered, help us to find answer for this one

104.

Carefully study the following code snippet and answer the question that follows:

var http = require('http');

var server = http.createServer(function (request1, result1) {

console.log('This is request Header');

console.log(request1.headers);

result1.write('Working with HTTP');

result1.end();

}).listen(3000);

console.log('This is a sample');

When a client request is made, which of the following outputs is obtained on a web browser?


Answer

Correct Answer:

Working with HTTP


Note: This Question is unanswered, help us to find answer for this one

105.

Which of the following HTTP methods for collection URLs is used to replace the entire collection with a new collection?

Answer

Correct Answer:

PUT 


Note: This Question is unanswered, help us to find answer for this one

106.

Study the following code snippet and determine which code line contains an error.

1. var connect =require('connect'),

2. http = require('http');

3. var app = connect();

4. http.createServer(http).listen(3000);

5. console.log('port 3000');


Answer

Correct Answer:

Line 4


Note: This Question is unanswered, help us to find answer for this one

107.

The HTML code given in the image, when executed, should create a button and hovering over this button should display ‘New Button'. Which of the following code snippets should replace '??' in the given code to obtain the desired result?

Answer

Correct Answer:

$(function0{

$('button').tooltip0: J):



Note: This Question is unanswered, help us to find answer for this one

108.

What will be the output of the following code snippet?

var myVar = 'First Value';

if (true) {

(function () {

var myVar ='Second Value'

})();

}

console.log(myVar);


Answer

Correct Answer:

First Value


Note: This Question is unanswered, help us to find answer for this one

109. If you create a collection by using the createCollection method with [safe : true] option, then which of the following types of behaviors will be observed?

Answer

Correct Answer: It will create a new collection if it does not exist. But ifa collection already exists. then it will return an error.

Note: This Question is unanswered, help us to find answer for this one

110. What is the purpose of using URL hashes in Node.js?

Answer

Correct Answer: URL hashes are used to denote that different content is being displayed in a web application that consists of a single page.

Note: This Question is unanswered, help us to find answer for this one

111.

The following code snippet when executed, should create a web server that serves the web page 'idx.html' from 'testing5' folder. However, the syntax of lines 3 and 4 are not correct. Select the correct replacements of lines 3 and 4 from the given answer options.

1. var exp = require ('express');

2. var serveStatic = require ('serve-static');

3. var app = express()

4. .use(serveStatic(dirname /testing5, {'index': ['idx.html']}))

5. .listen(3000);


Answer

Correct Answer:

var app = expo

.use(serveStatic(_dirname +‘/testing5'.{'index': ['idx.html']])) 



Note: This Question is unanswered, help us to find answer for this one

112.

What output will be generated on the execution of the following lines of code?

var path = require('path');

console.log(path.join('test1'. 'ltest2'. 'test3'));


Answer

Correct Answer:

test1\test2\test3


Note: This Question is unanswered, help us to find answer for this one

113.

A module 'rimraf' is installed locally in a Node.js project.

The following code snippet is supposed to delete a directory named testing2 from the same project however the code contains some errors identify which code lines contain an error.

1.var rim1 = require('rimraf'); 

2.rimraf('./Testing2', function(error1)){ 

3. if(error1) console.log('This is an error', error1); 

4. else console.log('Directory deleted successfully'); 

5.}

Answer

Correct Answer:

Lines 2 and 5  


Note: This Question is unanswered, help us to find answer for this one

114.

Carefully study the following code snippet and answer the question that follows.

var exp = require('express');

var application1 = exp() .use(function (rq, rs){

console.log('Cookie Header:\n', rq.headers['cookie']);

rs.cookie('\n name', 'Node.js');

rs.end('Hello Express World');

}).listen(3000);

Which of the following code snippets should be added at the top of those files that use the mongodb module?


Answer

Correct Answer:

Cookie Header:

Note: This Question is unanswered, help us to find answer for this one

115.

Which of the following code snippets should be added at the top of those files that use the mongodb module?

Answer

Correct Answer:

Var Db = require('mongodb‘).Db,

Connection = require('mongodb').Connection.

Server = require('m0ngodb').Server;



Note: This Question is unanswered, help us to find answer for this one

116.

The following code snippet should provide the output '[125, 450, 80]'. However, line 3 contains an error. What should be the correct syntax of line 3?


1)var m1 =[5.10. 35,125,450. 80. 40];

2)var _ = require(’underscore');

3)var output = _(m1. function (vall) 4)[

5) return val1 >50

6)}):

7)console.log(output);


Answer

Correct Answer:

var output = _.f‌iIter(m1, function (val1)[ 


Note: This Question is unanswered, help us to find answer for this one

117.

Which of the following methods is used for setting a signed cookie?

Note: Consider the function inside which the method setting is performed as: function (r, s).


Answer

Correct Answer:

s.cookie(name, value, [signed:true})  


Note: This Question is unanswered, help us to find answer for this one

118. Which of the following is the correct function of the ng-repeat directive?

Answer

Correct Answer: It takes the DOM element it is def‌ined on and duplicates it for every element in the ViewModel List.

Note: This Question is unanswered, help us to find answer for this one

119. Which of the following commands in the Node debugger helps user to step out of the current executing function?

Answer

Correct Answer: out

Note: This Question is unanswered, help us to find answer for this one

120. Which of the following commands is used to get out of an undesirable ellipsis: a situation in which three dots [...] are repeatedly displayed?

Answer

Correct Answer: break

Note: This Question is unanswered, help us to find answer for this one

121.

In Node.js. which of the following modules use(s) the 'require' function?

1) Core module

2) File module

3) External node_modules


Answer

Correct Answer:

All 1, 2, and 3


Note: This Question is unanswered, help us to find answer for this one

122. Which of the following testing assertions uses the operator === for testing equality?

Answer

Correct Answer: strictEqual(value, expected)

Note: This Question is unanswered, help us to find answer for this one

123. Which of the following is not a part of the AAA pattern followed by good tests in chai library?

Answer

Correct Answer: Allow

Note: This Question is unanswered, help us to find answer for this one

124.

What will be the output of the following code snippet in Node.js?

var inherits = require(function Parent(){

this.message ='Example ';

}

Parent.PrototyPe.exP = function(){ return this.message + 'parent class ' };

function Child(){Parent.call(this);

} inherits(Child, Parent);

Child.prototype.exp = function () { return Parent.prototype.exp.call(this) + 'child class';

}

var chd = new Child();

console.log(chd.exp());

Answer

Correct Answer:

Example parent class child class


Note: This Question is unanswered, help us to find answer for this one

125. Which of the following functions is used to create an HTTPS server? (Consider the two parameters of the function as rq and rs, respectively.)

Answer

Correct Answer: https.createServer(options. function(rq. rs){]).listen(3000);

Note: This Question is unanswered, help us to find answer for this one

126. In Node.js, which of the following keywords is used to load a module?

Answer

Correct Answer: require

Note: This Question is unanswered, help us to find answer for this one

127. In Angular.js, which of the following acts as a link between the view and the model and is passed to the controller?

Answer

Correct Answer: $scope

Note: This Question is unanswered, help us to find answer for this one

128.

Choose True or False:

Angular.js uses two-way data-binding for attaining synchronization between the view and the model.


Answer

Correct Answer:

True 


Note: This Question is unanswered, help us to find answer for this one

129.

What will be the correct output of the following function?

process.nextTick(function(){

console.log('Example')}); console.log('Hello'); console.log('World');

Answer

Correct Answer:

Hello

World

Example 



Note: This Question is unanswered, help us to find answer for this one

130.

Which of the following is a valid JSON object in Node.js?


Answer

Correct Answer:

phoneinfo : [

{ type : home, number : 123456},

{type : mobile, number : 8888888}

]}

{  



Note: This Question is unanswered, help us to find answer for this one

131.

However, lines 11 and 13 contain errors. Which of the following is the correct syntax of line 11 and line 13?


Answer

Correct Answer:

Line 11 :Animal_Example.call(this. name);

Line 13 : Bird_Example.prototype._proto_ = Animal_Example.prototype;



Note: This Question is unanswered, help us to find answer for this one

132.

The program given in the image should provide the following output:

Answer

Correct Answer:

Pigeon is walking toward point B



Note: This Question is unanswered, help us to find answer for this one

133. Which of the following is the most popular package manager for Node?

Answer

Correct Answer: NPM

Note: This Question is unanswered, help us to find answer for this one

134.

How to fire event using EventEmitter: var events = new events.EventEmitter();

Answer

Correct Answer: events.emit('eventName');

Note: This Question is unanswered, help us to find answer for this one

135.

Which of the following code can make a request to a web server?

Answer

Correct Answer: http.request(options, callback)

Note: This Question is unanswered, help us to find answer for this one

136.

For Linux, which of the following environment variables is needed to set for successful NodeJS installation?

Answer

Correct Answer: export PATH=$PATH:/usr/local/nodejs/bin

Note: This Question is unanswered, help us to find answer for this one

137.

Which are the following debug commands to debug node server?

Answer

Correct Answer: node debug
node debug -p
node debug

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

138.

What output will this code produce in the console? const EventEmitter = require('events');

const myEmit = new EventEmitter();

myEmit.on('slick', () => {});

myEmit.on('key', () => {});

const symbol = Symbol('init');

myEmit.on(symbol, () => {});

console.log(myEmit.eventNames()); 

Answer

Correct Answer: [ 'slick', 'key', Symbol(init) ]

Note: This Question is unanswered, help us to find answer for this one

139.

Which of the following code converts a buffer buf to JSON object? 

Answer

Correct Answer: buf.toJSON()

Note: This Question is unanswered, help us to find answer for this one

140.

What is the output when the following code is executed? var http = require("http"); var server = http.createServer(function(req, res) { res.writeHead(200, {"Content-Type": "text/html"}); res.end(` HTML Render Response

Testing Response!

${req.url}

${req.method}

`); }); server.listen(3000); console.log("Server listening on port 3000"); 

Answer

Correct Answer: Server listening on port 3000

Note: This Question is unanswered, help us to find answer for this one

141.

What is the output in console of this code?

var events = require('events');

var myEventEmitter = new events.EventEmitter();

myEventEmitter.once('a', function () {

console.log('a')});

myEventEmitter.on('b', function () {

console.log('b')});

myEventEmitter.emit('a');

myEventEmitter.emit('b');

myEventEmitter.emit('a');

myEventEmitter.emit('b'); 

Answer

Correct Answer: a b b

Note: This Question is unanswered, help us to find answer for this one

142.

How can you access the command line arguments passed to your program? 

Answer

Correct Answer: process.argv

Note: This Question is unanswered, help us to find answer for this one

143.

Select valid stream instances:

Answer

Correct Answer: stream.Transform
stream.Duplex
stream.Write
stream.Read

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

144.

How to convert from Buffer instance to string of base64? 

Answer

Correct Answer: myBuffer.toString(“base64”);

Note: This Question is unanswered, help us to find answer for this one

145.

Which method of fs module is used to truncate a file? 

Answer

Correct Answer: fs.ftruncate(fd, len, callback)

Note: This Question is unanswered, help us to find answer for this one

146.

What does the following line of code do? var http = require("http"); 

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

147.

Which of the following is true about writable stream? 

Answer

Correct Answer: Both of the above.

Note: This Question is unanswered, help us to find answer for this one

148.

Which code will return total system memory in bytes? os is included like this: const os = require('os'); 

Answer

Correct Answer: os.totalmem()

Note: This Question is unanswered, help us to find answer for this one

149.

What is the syntax to list all commands in REPL? 

Answer

Correct Answer: .help

Note: This Question is unanswered, help us to find answer for this one

150.

REPL stands for : 

Answer

Correct Answer: Read Eval Print Loop

Note: This Question is unanswered, help us to find answer for this one

151.

What is Callback? 

Answer

Correct Answer: Callback is an asynchronous equivalent for a function.

Note: This Question is unanswered, help us to find answer for this one

152.

Which of the following methods alone will write a file in Node.js? (check all that apply)

Answer

Correct Answer: fs.write()
fs.writeFile()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

153.

Which of the following methods can be used to read the filenames of a directory?

Answer

Correct Answer: fs.readdir()
fs.readdirSync()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

154.

Which function will delete a file? 

Answer

Correct Answer: fs.unlink(path,callback);

Note: This Question is unanswered, help us to find answer for this one

155.

Which of the following method resolves an ip address to an array of hostnames? 

Answer

Correct Answer: dns.reverse(ip, callback)

Note: This Question is unanswered, help us to find answer for this one

156.

Which of the following is true about Node.JS? 

Answer

Correct Answer: All of the above.

Note: This Question is unanswered, help us to find answer for this one

157.

Which of the following is correct way to imports http module? 

Answer

Correct Answer: require('http')

Note: This Question is unanswered, help us to find answer for this one

158.

How to add a listener to event emitter? 

Answer

Correct Answer: eventEmitter.on(‘event',connectHandler);

Note: This Question is unanswered, help us to find answer for this one

159.

Which of the following NPM commands will install both dependencies and devDependencies of a given project? 

Answer

Correct Answer: depends on NODE_ENV environment variable

Note: This Question is unanswered, help us to find answer for this one

160.

In which of the following areas, Node.js is not advised to be used? 

Answer

Correct Answer: CPU intensive applications

Note: This Question is unanswered, help us to find answer for this one

161.

How can the output of one stream be provided as input to another stream? 

Answer

Correct Answer: stream1.pipe(stream2);

Note: This Question is unanswered, help us to find answer for this one

162.

Which of the following code prints current directory? 

Answer

Correct Answer: console.log('Current directory: ' + process.cwd());

Note: This Question is unanswered, help us to find answer for this one

163.

Which of the following can be used to access the environment variable? 

Answer

Correct Answer: process.env

Note: This Question is unanswered, help us to find answer for this one

164.

The NODE_DEBUG environment variable specifically turns logs for the following core functionality?

Answer

Correct Answer: fs

Note: This Question is unanswered, help us to find answer for this one

165.

Which of the following methods will write "text" without a trailing new line? 

Answer

Correct Answer: process.stdout.write('text')

Note: This Question is unanswered, help us to find answer for this one

166.
Which of the following frameworks is most popular Node.js framework?
 

 

Answer

Correct Answer: Express

Note: This Question is unanswered, help us to find answer for this one

167.
Which command will show all the modules installed locally?
 

 

Answer

Correct Answer: npm ls

Note: This Question is unanswered, help us to find answer for this one

168.
Which of the following utility modules are available in NodeJS?
 

 

Answer

Correct Answer: All of above

Note: This Question is unanswered, help us to find answer for this one

169.
Which of the following methods is used to check modifications in files?
 

 

Answer

Correct Answer: watch

Note: This Question is unanswered, help us to find answer for this one

170.

How to Terminate Node REPL using the following short key? 

Answer

Correct Answer: ctrl + c twice

Note: This Question is unanswered, help us to find answer for this one

171.

Which of the following is not a HTTP method? 

Answer

Correct Answer: D. header

Note: This Question is unanswered, help us to find answer for this one

172.

Which of the following statement is valid? 

Answer

Correct Answer: C. Both of the above

Note: This Question is unanswered, help us to find answer for this one

173.

Which of the following code is valid to get a joint path? 

Answer

Correct Answer: A. path.join('/test0', 'test11', '2slashes/1slash', 'tab', '..')

Note: This Question is unanswered, help us to find answer for this one

174.

Which of the following is operates asynchronous logic?

Answer

Correct Answer: Callbacks
Event Emitters

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

175.

In express application you are handling the route '/user/:name'. How could you access the 'name' property?

Answer

Correct Answer: req.params.name

Note: This Question is unanswered, help us to find answer for this one

176.

Which of the following should not to use in NodeJS?

Answer

Correct Answer: CPU Intensive Applications

Note: This Question is unanswered, help us to find answer for this one

177.

Which of the following is the result of module.id ?

Answer

Correct Answer: file name

Note: This Question is unanswered, help us to find answer for this one

178.

Which of the following timers methods exists in Node.js?

Answer

Correct Answer: clearTimout
setTimeout

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

179.

Which of the following variables you can use in modules?

Answer

Correct Answer: __filename
__dirname

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

180.

Which of the following classes is the parent for repl.REPLServer class?

Answer

Correct Answer: readline.Interfase

Note: This Question is unanswered, help us to find answer for this one

181.

Which of the libs are exists in Node Core Libraries?

Answer

Correct Answer: HTTP
Path

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

182.

Which of the following code print the name of operating system?

Answer

Correct Answer: console.log('type : ' + os.type());

Note: This Question is unanswered, help us to find answer for this one

183.

Which are the below NodeJS features?

Answer

Correct Answer: Very Fast
No Buffering
Single Threaded but Highly Scalable
Asynchronous and Event Driven

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

184.

Which of the following engine built of NodeJS framework/platform?

Answer

Correct Answer: Google Chrome's JavaScript V8 Engine

Note: This Question is unanswered, help us to find answer for this one

185.

Which of the following module require to create server for NodeJS?

Answer

Correct Answer: http

Note: This Question is unanswered, help us to find answer for this one

186.

Which of the following values is correct about how many lines defaults can be in NODE_REPL_HISTORY_SIZE?

Answer

Correct Answer: 1000

Note: This Question is unanswered, help us to find answer for this one

187.

Which of the following commands exit from REPL?

Answer

Correct Answer: double ctrl+c

Note: This Question is unanswered, help us to find answer for this one

188.

Which of the following libs provides basic HTTP authentication for protecting data?

Answer

Correct Answer: connect

Note: This Question is unanswered, help us to find answer for this one

189.

Which of the following libs is using for debugging node-applications?

Answer

Correct Answer: node-inspector

Note: This Question is unanswered, help us to find answer for this one

190.

How would you start node with debugger?

Answer

Correct Answer: node debug myscript.js

Note: This Question is unanswered, help us to find answer for this one

191.

Which of the following values can return async functions?

Answer

Correct Answer: Non of these

Note: This Question is unanswered, help us to find answer for this one

192.

Which of the following statement is true about the fs module of Node?

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

193.

What REST stands for?

Answer

Correct Answer: Representational State Transfer

Note: This Question is unanswered, help us to find answer for this one

194.

NodeJS includes a full-featured out-of-process debugging utility accessible via a which protocol?

Answer

Correct Answer: TCP-based protocol

Note: This Question is unanswered, help us to find answer for this one

195.

Which of the following file extensions supports Node Module System ?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

196.

Route path: /train/from-:to Request URL: http://localhost:3000/train/AHM-BRD What should be request params?

Answer

Correct Answer: { "from": "AHM", "to": "BRD" }

Note: This Question is unanswered, help us to find answer for this one

197.

Which of the following ways to create a child process?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

198.

Which of the following files using for setting start point in deployment services?

Answer

Correct Answer: PROCFILE

Note: This Question is unanswered, help us to find answer for this one

199.

You are handling POST request to the server. Which express middleware gives access to the submitted form data?

Answer

Correct Answer: bodyParser

Note: This Question is unanswered, help us to find answer for this one

200.

What is the use of Underscore variable in REPL session?

Answer

Correct Answer: To get the last result

Note: This Question is unanswered, help us to find answer for this one

201.

Suppose we have this construction in Expres.js project,Which of the following paths will match this route? app.get('/kl+mn', function(req, res) { return res.send('kl+mn'); });

Answer

Correct Answer: klmn
kllmn

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

202.

Which of the following flags working with npm?

Answer

Correct Answer: -O

Note: This Question is unanswered, help us to find answer for this one

203.

Which of the following command-line arguments to "npm install" will allow an NPM package's binaries to be run outside the project folder?

Answer

Correct Answer: -g
--global

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

204.

Which Node.js module can be used to get the IP address of the server the program is running on?

Answer

Correct Answer: os

Note: This Question is unanswered, help us to find answer for this one

205.

What does the following code do?

var http = require('http');

var fs = require('fs');

var file = fs.createWriteStream("file.png");

var request = http.get("http://path/to/file.png",

function(response) { response.pipe(file); });

Answer

Correct Answer: It creates an HTTP GET request and pipes its response into a writeable file stream.

Note: This Question is unanswered, help us to find answer for this one

206.

Which of the following statements is true about the console Object in Node.js?

Answer

Correct Answer: "console.log" can take only a single argument.

Note: This Question is unanswered, help us to find answer for this one

207.

Which of the following methods can be used to read the contents of a directory?

Answer

Correct Answer: fs.readdir()

Note: This Question is unanswered, help us to find answer for this one

208.

Which of the following statements are true about the child_process module in Node.js?

Answer

Correct Answer: "require('child_process').spawn()" can be used to create a child process.
"require('child_process').fork()" can be used to create a child process.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

209.

Which of the following statements are true about the module.exports object in Node.js?

Answer

Correct Answer: It is the object that gets returned from a require() call.
Assigning an export object to module.exports will rebind the local exports variable.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

210.

Which of the following will open a file, then read its contents one line at a time?

Answer

Correct Answer: fs.createReadStream()

Note: This Question is unanswered, help us to find answer for this one

211.

Which of the following will open a file, then read its contents one line at a time?

Answer

Correct Answer: __filename

Note: This Question is unanswered, help us to find answer for this one

212.

Which of the following will synchronously check if a file/directory exists?

Answer

Correct Answer: fs.existsSync()

Note: This Question is unanswered, help us to find answer for this one

213.

Which of the following console commands will update all installed global packages to the latest available versions?

Answer

Correct Answer: npm update -g

Note: This Question is unanswered, help us to find answer for this one

214.

What does process.argv[1] contain?

Answer

Correct Answer: The file path of the JavaScript file.

Note: This Question is unanswered, help us to find answer for this one

215.

What does the following command do? npm view <package-name> version

Answer

Correct Answer: It shows the latest version of the package that is available.

Note: This Question is unanswered, help us to find answer for this one

216.

Which of the following will copy a file in Node.js?

Answer

Correct Answer: var fs = require('fs'); fs.createReadStream('test.file').pipe(fs.createWriteStream('newFile.file'));

Note: This Question is unanswered, help us to find answer for this one

217. Which node module is used to make API request?

Answer

Correct Answer: request

Note: This Question is unanswered, help us to find answer for this one

218. Which of these are valid ways to apply middleware in Express?

Answer

Correct Answer: All of these.

Note: This Question is unanswered, help us to find answer for this one

219. Which is a correct way to check the latest released version of the Express module with npm?

Answer

Correct Answer: npm view express version

Note: This Question is unanswered, help us to find answer for this one

220. A Buffer can be resized.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

221. Which of the following is NOT true about Node 0.6?

Answer

Correct Answer: Unix binary distributed

Note: This Question is unanswered, help us to find answer for this one

222. Which of these is not a valid version according to npm semantic versioning?

Answer

Correct Answer: "1.2.3b"

Note: This Question is unanswered, help us to find answer for this one

223. What is the default request limit to the same origin on a node.js http client?

Answer

Correct Answer: 5

Note: This Question is unanswered, help us to find answer for this one

224. What is the default memory limit on a node process?

Answer

Correct Answer: 512mb on 32-bit systems, and 1gb on 64-bit systems.

Note: This Question is unanswered, help us to find answer for this one

225. Is it possible to execute node.js system command synchronously?

Answer

Correct Answer: Yes, with a third party library

Note: This Question is unanswered, help us to find answer for this one

226. How do you create a new client connection via SSL?

Answer

Correct Answer: tls.connect()

Note: This Question is unanswered, help us to find answer for this one

227. When creating a command line tool with Node.js, which expresion will allow you access the first command line argument?

Answer

Correct Answer: process.argv[2]

Note: This Question is unanswered, help us to find answer for this one

228. In the following Express routing method, what is the maximum number of arguments that may be passed to the callback function "routeHandler"? app.all("*", routeHandler )

Answer

Correct Answer: 4

Note: This Question is unanswered, help us to find answer for this one

229. How do you properly timestamp a log message?

Answer

Correct Answer: require('util').log('message')

Note: This Question is unanswered, help us to find answer for this one

230. If the Connect node package module is updated from version 2.8.5 to version 3.1.0 which dependency in your package.json file may break your application on update?

Answer

Correct Answer: "connect": ">=2.5"

Note: This Question is unanswered, help us to find answer for this one

231. Which express 3 middleware has _NOT_ been moved into its own module in express 4.

Answer

Correct Answer: static

Note: This Question is unanswered, help us to find answer for this one

232. Which of these is a valid way to output the contents of a file?

Answer

Correct Answer: console.log( fs.readFileSync("file.txt") );

Note: This Question is unanswered, help us to find answer for this one

233. Which of these is NOT a global object?

Answer

Correct Answer: Stream

Note: This Question is unanswered, help us to find answer for this one

234. In Express, which of these would NOT expose the variable "title" to the template renderer?

Answer

Correct Answer: res.render.title = "My App";

Note: This Question is unanswered, help us to find answer for this one

235. What would be the value after that the timeouts has been fired? var x = 0; function callback(err,result){ if (err) { x--; return; } x++; } setTimeout(callback,10); setTimeout(callback,10,"Error");

Answer

Correct Answer: 0

Note: This Question is unanswered, help us to find answer for this one

236. Which of the following is not a global object in node.js?

Answer

Correct Answer: path

Note: This Question is unanswered, help us to find answer for this one

237. The http.ServerResponse is an example of a what?

Answer

Correct Answer: A writable Stream.

Note: This Question is unanswered, help us to find answer for this one

238. Which Express middleware must come before express.session() in your stack?

Answer

Correct Answer: express.cookieParser()

Note: This Question is unanswered, help us to find answer for this one

239. Which of these are required fields in your package.json file?

Answer

Correct Answer: "name" and "version"

Note: This Question is unanswered, help us to find answer for this one

240. To parse a URL string use____?

Answer

Correct Answer: querystring

Note: This Question is unanswered, help us to find answer for this one

241. The Javascript used in node.js:

Answer

Correct Answer: Is on-par with a recent version of Chrome

Note: This Question is unanswered, help us to find answer for this one

242. If an EventEmitter object emits an 'error' event and there is no listener for it, node will:

Answer

Correct Answer: Print a stack trace and exit

Note: This Question is unanswered, help us to find answer for this one

243. In Node.js, the result of an asynchronous function can be accessed how?

Answer

Correct Answer: By the value passed as the second argument of the callback.

Note: This Question is unanswered, help us to find answer for this one

244. What is NOT a valid method to create a child process instance?

Answer

Correct Answer: popen(3)

Note: This Question is unanswered, help us to find answer for this one

245. Node.js clusters are child processes that do NOT share server ports?

Answer

Correct Answer: false

Note: This Question is unanswered, help us to find answer for this one

246. What command is used to end a Node.JS process?

Answer

Correct Answer: .exit

Note: This Question is unanswered, help us to find answer for this one

247. Which of these is definitely true of Node.js?

Answer

Correct Answer: Node.js can be used to create command line tools.

Note: This Question is unanswered, help us to find answer for this one

248. var http_server = require('http'); how can you create a server?

Answer

Correct Answer: http_server.createServer(function(){});

Note: This Question is unanswered, help us to find answer for this one

249. Is it possible to use jQuery on Node.js?

Answer

Correct Answer: Yes, with third party server-side DOM module.

Note: This Question is unanswered, help us to find answer for this one

250. The process object is an instance of____?

Answer

Correct Answer: EventEmitter

Note: This Question is unanswered, help us to find answer for this one

251. Given the following route and request, which Request object property will hold the value of 20 in the Express handler? Route: "/post/:id" Request: "/post/30?start=20"

Answer

Correct Answer: req.query.start

Note: This Question is unanswered, help us to find answer for this one

252. Node.js is a truly parallel technology.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

253. Which of the following statements are true about the module.exports object?

Answer

Correct Answer: It is the object returned from a require() call

Note: This Question is unanswered, help us to find answer for this one

254. True or false? Node.js is multi-core by nature.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

255. Node will run until its sure that no further ___ are available.

Answer

Correct Answer: Events-handlers

Note: This Question is unanswered, help us to find answer for this one

256. The VM module allows one to:

Answer

Correct Answer: Run JavaScript code in a sandbox environment

Note: This Question is unanswered, help us to find answer for this one

257. Which of the following methods will print to the console without a trailing new line?

Answer

Correct Answer: process.stdout.write

Note: This Question is unanswered, help us to find answer for this one

258. Express middleware is actually handled by what other Node.js module?

Answer

Correct Answer: Connect

Note: This Question is unanswered, help us to find answer for this one

259. The process object is an instance of what class?

Answer

Correct Answer: EventEmitter

Note: This Question is unanswered, help us to find answer for this one

260. Which of these Express middleware stacks will NOT log favicon requests?

Answer

Correct Answer: app.use(express.favicon()); app.use(express.logger()); app.use(express.static(__dirname + '/public'));

Note: This Question is unanswered, help us to find answer for this one

261. By executing node without any arguments from the command-line:

Answer

Correct Answer: you will be dropped into the REPL

Note: This Question is unanswered, help us to find answer for this one

262. What built in class is a global type for dealing with binary data directly?

Answer

Correct Answer: Buffer

Note: This Question is unanswered, help us to find answer for this one

263. Given the following route and request, which Request object property will hold the value of 30 in the Express handler? Route: "/post/:id" Request: "/post/30?start=20"

Answer

Correct Answer: req.params.id

Note: This Question is unanswered, help us to find answer for this one

264. The first argument passed to a Node.js asynchronous callback is always what?

Answer

Correct Answer: An Error object if an error has occured.

Note: This Question is unanswered, help us to find answer for this one

265. Which company manages and maintains node.js?

Answer

Correct Answer: Joyent

Note: This Question is unanswered, help us to find answer for this one

266. To create an instance of the HTTP object, which function is used?

Answer

Correct Answer: require

Note: This Question is unanswered, help us to find answer for this one

267. What do the lines like symbols = symbols || SYMBOLS_DEFAULT; do?

Answer

Correct Answer: This is a JS idiom for setting default arguments.

Note: This Question is unanswered, help us to find answer for this one

268. To exit out of a function you should use _____?

Answer

Correct Answer: return;

Note: This Question is unanswered, help us to find answer for this one

269. If an error occures in an Express middleware function, what is the best way to pass the error object to the subsequent handlers?

Answer

Correct Answer: function( req, res, next){ ... next( err ); }

Note: This Question is unanswered, help us to find answer for this one

270. What is typically the first parameter in node.js callback functions?

Answer

Correct Answer: Error

Note: This Question is unanswered, help us to find answer for this one

271. Which function allows you to chain event listeners?

Answer

Correct Answer: on()

Note: This Question is unanswered, help us to find answer for this one

272. Which of the following is a standard node module, included with the default install?

Answer

Correct Answer: fs

Note: This Question is unanswered, help us to find answer for this one

273. What syntax is correct for reading environment variable?

Answer

Correct Answer: process.env.ENV_VARIABLE

Note: This Question is unanswered, help us to find answer for this one

274. The Cryptography module requires OpenSSL.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

275. The interactive shell is also called_____?

Answer

Correct Answer: REPL

Note: This Question is unanswered, help us to find answer for this one

276. How do you start the node.js REPL?

Answer

Correct Answer: node

Note: This Question is unanswered, help us to find answer for this one

277. Timer functions are built into node.js, you do not need to require() this module in order to use them.

Answer

Correct Answer: true

Note: This Question is unanswered, help us to find answer for this one

278. Which of these is a built-in module that can be used for unit testing in Node.js?

Answer

Correct Answer: Assert

Note: This Question is unanswered, help us to find answer for this one

279. What does the Zlib module provide?

Answer

Correct Answer: Bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes

Note: This Question is unanswered, help us to find answer for this one

280. True or False: node.js runs in a single thread.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

281. How can I call an object function from my module if my module name is "iModule"?

Answer

Correct Answer: require('iModule').mObject();

Note: This Question is unanswered, help us to find answer for this one

282. What interface is used to create a server through Node.js

Answer

Correct Answer: http

Note: This Question is unanswered, help us to find answer for this one

283. What method is used to parse JSON using NodeJS?

Answer

Correct Answer: JSON.parse();

Note: This Question is unanswered, help us to find answer for this one

284. Where does Node run on your machine?

Answer

Correct Answer: as an application

Note: This Question is unanswered, help us to find answer for this one

285. How do you cause a function to be invoked at a specified time later?

Answer

Correct Answer: setTimeout(fn, 1000)

Note: This Question is unanswered, help us to find answer for this one

286. In the following Express route stack, which handler will be called for "GET /item/23"? app.get("/", routes.index ); app.get("/item", routes.item ); app.get("/item/:id", routes.id ); app.post("/item/:id", routes.post );

Answer

Correct Answer: routes.id

Note: This Question is unanswered, help us to find answer for this one

287. What does the require call return?

Answer

Correct Answer: module.exports object

Note: This Question is unanswered, help us to find answer for this one

288.

Running the following code, what will the console output?

var http = require('http');

http.createServer( function (request, response) { response.writeHead(200,

{'Content-Type': 'text/plain'});

response.end('Hello World\n'); } ).listen(8000);

console.log('Server running at http://localhost:8000/');

Answer

Correct Answer: Server running at http://localhost:8000/

Note: This Question is unanswered, help us to find answer for this one

289. node.js excels at dealing with:

Answer

Correct Answer: I/O-bound tasks

Note: This Question is unanswered, help us to find answer for this one

290. Which npm command will load all dependencies in the local node_modules folder?

Answer

Correct Answer: npm install

Note: This Question is unanswered, help us to find answer for this one

291. Which is of the following is a potential advantage of using Node.js?

Answer

Correct Answer: All of these.

Note: This Question is unanswered, help us to find answer for this one

292. What function is used to write out application errors/events?

Answer

Correct Answer: console.log

Note: This Question is unanswered, help us to find answer for this one

293. What interface is used to access folders on your local drive

Answer

Correct Answer: fs

Note: This Question is unanswered, help us to find answer for this one

294.

In this code:

function myLog(err, data) {

console.log(err, data);

} fs.readFile('/tmp/sample', myLog);

The function 'myLog' is used as a(an):

Answer

Correct Answer: Callback

Note: This Question is unanswered, help us to find answer for this one

295. What is the code to access the DNS module?

Answer

Correct Answer: require('dns');

Note: This Question is unanswered, help us to find answer for this one

296. Use _____ to step through your code.

Answer

Correct Answer: breakpoints

Note: This Question is unanswered, help us to find answer for this one

297. What kind of application is better suited to node.js?

Answer

Correct Answer: I/O Bound Applications

Note: This Question is unanswered, help us to find answer for this one

298. How do you call a function attached to an object that will be executed when the object emits an event?

Answer

Correct Answer: Listener

Note: This Question is unanswered, help us to find answer for this one

299. What does Node.js run on?

Answer

Correct Answer: server

Note: This Question is unanswered, help us to find answer for this one

300. What does "npm" stand for?

Answer

Correct Answer: Node Package Manager

Note: This Question is unanswered, help us to find answer for this one

301. Which of the following command-line arguments to "npm install" will allow a module to be installed outside the project folder?

Answer

Correct Answer: --global

Note: This Question is unanswered, help us to find answer for this one

302. How does one get access to Node.js?

Answer

Correct Answer: download the install

Note: This Question is unanswered, help us to find answer for this one

303. A popular web application for framework for node?

Answer

Correct Answer: express

Note: This Question is unanswered, help us to find answer for this one

304. Why is Node.js important?

Answer

Correct Answer: It allows asynchronous processing in the background without interupting the user

Note: This Question is unanswered, help us to find answer for this one

305. In node.js you can write and run code in what language?

Answer

Correct Answer: Javascript

Note: This Question is unanswered, help us to find answer for this one

306. True or False: node.js can call other command line scripts.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

307. Which of the following can be created and managed using node.js?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

308. WebSockets with Socket.io can be used to?

Answer

Correct Answer: All of these.

Note: This Question is unanswered, help us to find answer for this one

309. What is a Buffer?

Answer

Correct Answer: Raw memory allocated outside the v8 heap

Note: This Question is unanswered, help us to find answer for this one

310. What is node.js based on?

Answer

Correct Answer: Chrome's JavaScript runtime

Note: This Question is unanswered, help us to find answer for this one

311. A module is an____?

Answer

Correct Answer: Object

Note: This Question is unanswered, help us to find answer for this one

312. How do you output to console in node.js?

Answer

Correct Answer: util.log or console.log

Note: This Question is unanswered, help us to find answer for this one

313. How do you require a module?

Answer

Correct Answer: var module = require('mymodule')

Note: This Question is unanswered, help us to find answer for this one

314. Which is a comment in node?

Answer

Correct Answer: //comment

Note: This Question is unanswered, help us to find answer for this one

315. To declare a variable use what keyword?

Answer

Correct Answer: var

Note: This Question is unanswered, help us to find answer for this one

316. REPL is:

Answer

Correct Answer: Read-Eval-Print-Loop, a way to interactively run code

Note: This Question is unanswered, help us to find answer for this one

317. If you have a node program called example.js, how would that be excuted?

Answer

Correct Answer: node example.js

Note: This Question is unanswered, help us to find answer for this one

318. If you have a problem with your code, where would you look?

Answer

Correct Answer: console.log

Note: This Question is unanswered, help us to find answer for this one

319. net.Server emits an event every time a ____ connects to the server.

Answer

Correct Answer: peer

Note: This Question is unanswered, help us to find answer for this one

320. What program is used to programmtically control the browser?

Answer

Correct Answer: javascript

Note: This Question is unanswered, help us to find answer for this one