Correct Answer:
Crypto
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
ECMAScript modules cannot be used natively in Node.
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Google V8
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
V8 JavaScript engine
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
IfError
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Yes, through the assert module
Note: This Question is unanswered, help us to find answer for this one
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
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
Correct Answer:
Path.join
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
ReadableStream.pipe(writableStream)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Buffer
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Const numInstances = require('os').cpus().length;
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Vm
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Event names must be camelCase strings.
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Process
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
String_decoder
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Async_hooks
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Assert
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Binding.gyp
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Read, eval, print, loop
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Const { readFile } = require(fs).promises
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Crypto
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Cluster
Note: This Question is unanswered, help us to find answer for this one
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
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
Correct Answer:
Libuv
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Exports, require, module, __filename, __dirname
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Node -h
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Start
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
An object representing an array that has five elements
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Process. stdinfo
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
It is the safest version for long-term support.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
To provide methods to work with files
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Node index.js
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Server.listen
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
The VM (like VS or Chakra)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Trace
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Exec(
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
__filename
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
EventEmitter.emit('change');
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
The forked process will have its own VM instance.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Util.promisify(child_process.exec)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Node --no-warnings
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Require.cache
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Time
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Node -p
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
--inspect
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
N-API
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Yes, with the https or http2 modules
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Util.types.isDate(value)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Lookup
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
CreateReadStream
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Ftp
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
AllocUnsafe
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Crypto
Note: This Question is unanswered, help us to find answer for this one
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);
Correct Answer:
El Line 5
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
III The [w: 0] flag is passed to the database constructor that tells to wait until at least one confirmed 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
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
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?
Correct Answer:
Line 6
Note: This Question is unanswered, help us to find answer for this one
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)
Correct Answer:
11
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
console.log(
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Fulfilled
Note: This Question is unanswered, help us to find answer for this one
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');
Correct Answer:
14
Note: This Question is unanswered, help us to find answer for this one
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);
Correct Answer:
III Line 7
Note: This Question is unanswered, help us to find answer for this one
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
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.
Correct Answer:
14 & 15
Note: This Question is unanswered, help us to find answer for this one
What will be the output of the following code snippet in Node.js?
var x = 2.4;
var y = 9;
console.log(y/x)
Correct Answer:
3.75
Note: This Question is unanswered, help us to find answer for this one
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?
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
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);
Correct Answer:
Initial value: Hello Final value: undefined
Note: This Question is unanswered, help us to find answer for this one
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: };
Correct Answer:
Line 5
Note: This Question is unanswered, help us to find answer for this one
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]);
Correct Answer:
1
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
use
Note: This Question is unanswered, help us to find answer for this one
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] ]
Correct Answer:
example.listeners('data')
Note: This Question is unanswered, help us to find answer for this one
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?
Correct Answer:
var x = require('./first'); x();
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
$all
Note: This Question is unanswered, help us to find answer for this one
State if true or false.
In node.js, applications are processed asynchronously on a single thread.
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
browserify base3.js -o amdmodule.js
Note: This Question is unanswered, help us to find answer for this one
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)
Correct Answer:
John was born on 15 May, 1987
Note: This Question is unanswered, help us to find answer for this one
Choose True or False.
In MongoDB, it is possible to insert two values with same_id values into a collection.
Correct Answer:
False
Note: This Question is unanswered, help us to find answer for this one
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');
Correct Answer:
Called the handler
Note: This Question is unanswered, help us to find answer for this one
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.
Correct Answer:
Only1 and 3
Note: This Question is unanswered, help us to find answer for this one
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?
Correct Answer:
console.log(path.basename(completePath));
Note: This Question is unanswered, help us to find answer for this one
What output will be generated on the execution of the following code snippet in Node.js?
function Test()
{}
console.log(Test.prototype.constructor === Test);
Correct Answer:
true
Note: This Question is unanswered, help us to find answer for this one
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?
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
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);
Correct Answer:
[] [value: 55]
Note: This Question is unanswered, help us to find answer for this one
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);
Correct Answer:
First Process Complete: Process
Note: This Question is unanswered, help us to find answer for this one
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
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?
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
Correct Answer:
node --version
Note: This Question is unanswered, help us to find answer for this one
The following function belongs to which of the given http.Server events in Node.js:
function (request, socket, head){}
Correct Answer:
upgrade
Note: This Question is unanswered, help us to find answer for this one
Which of the following are the advantages of node_module?
a) It increases reusability.
b) It simplifies : ies the long file 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.
Correct Answer:
Only a, b, and c
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
openssl req ~x509 -new -key key.pem > cert.pem
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
npm install underscore
Note: This Question is unanswered, help us to find answer for this one
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")}
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
Correct Answer:
5858
Note: This Question is unanswered, help us to find answer for this one
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?
Correct Answer:
Working with HTTP
Note: This Question is unanswered, help us to find answer for this one
Which of the following HTTP methods for collection URLs is used to replace the entire collection with a new collection?
Correct Answer:
PUT
Note: This Question is unanswered, help us to find answer for this one
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');
Correct Answer:
Line 4
Note: This Question is unanswered, help us to find answer for this one
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?
Correct Answer:
$(function0{ $('button').tooltip0: J):
Note: This Question is unanswered, help us to find answer for this one
What will be the output of the following code snippet?
var myVar = 'First Value';
if (true) {
(function () {
var myVar ='Second Value'
})();
}
console.log(myVar);
Correct Answer:
First Value
Note: This Question is unanswered, help us to find answer for this one
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
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
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);
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
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'));
Correct Answer:
test1\test2\test3
Note: This Question is unanswered, help us to find answer for this one
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.}
Correct Answer:
Lines 2 and 5
Note: This Question is unanswered, help us to find answer for this one
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?
Correct Answer:
Cookie Header:
Note: This Question is unanswered, help us to find answer for this one
Which of the following code snippets should be added at the top of those files that use the mongodb module?
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
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);
Correct Answer:
var output = _.fiIter(m1, function (val1)[
Note: This Question is unanswered, help us to find answer for this one
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).
Correct Answer:
s.cookie(name, value, [signed:true})
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
It takes the DOM element it is defined on and duplicates it for every element in the ViewModel List.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
out
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
break
Note: This Question is unanswered, help us to find answer for this one
In Node.js. which of the following modules use(s) the 'require' function?
1) Core module
2) File module
3) External node_modules
Correct Answer:
All 1, 2, and 3
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
strictEqual(value, expected)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Allow
Note: This Question is unanswered, help us to find answer for this one
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());
Correct Answer:
Example parent class child class
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
https.createServer(options. function(rq. rs){]).listen(3000);
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
require
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
$scope
Note: This Question is unanswered, help us to find answer for this one
Choose True or False:
Angular.js uses two-way data-binding for attaining synchronization between the view and the model.
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
What will be the correct output of the following function?
process.nextTick(function(){
console.log('Example')}); console.log('Hello'); console.log('World');
Correct Answer:
Hello World Example
Note: This Question is unanswered, help us to find answer for this one
Which of the following is a valid JSON object in Node.js?
Correct Answer:
phoneinfo : [ { type : home, number : 123456}, {type : mobile, number : 8888888} ]} {
Note: This Question is unanswered, help us to find answer for this one
However, lines 11 and 13 contain errors. Which of the following is the correct syntax of line 11 and line 13?
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
The program given in the image should provide the following output:
Correct Answer:
Pigeon is walking toward point B
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
NPM
Note: This Question is unanswered, help us to find answer for this one
How to fire event using EventEmitter: var events = new events.EventEmitter();
Correct Answer:
events.emit('eventName');
Note: This Question is unanswered, help us to find answer for this one
Which of the following code can make a request to a web server?
Correct Answer:
http.request(options, callback)
Note: This Question is unanswered, help us to find answer for this one
For Linux, which of the following environment variables is needed to set for successful NodeJS installation?
Correct Answer:
export PATH=$PATH:/usr/local/nodejs/bin
Note: This Question is unanswered, help us to find answer for this one
Which are the following debug commands to debug node server?
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
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());
Correct Answer:
[ 'slick', 'key', Symbol(init) ]
Note: This Question is unanswered, help us to find answer for this one
Which of the following code converts a buffer buf to JSON object?
Correct Answer:
buf.toJSON()
Note: This Question is unanswered, help us to find answer for this one
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(`
${req.url}
${req.method}
`); }); server.listen(3000); console.log("Server listening on port 3000");Correct Answer:
Server listening on port 3000
Note: This Question is unanswered, help us to find answer for this one
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');
Correct Answer:
a b b
Note: This Question is unanswered, help us to find answer for this one
How can you access the command line arguments passed to your program?
Correct Answer:
process.argv
Note: This Question is unanswered, help us to find answer for this one
Select valid stream instances:
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
How to convert from Buffer instance to string of base64?
Correct Answer:
myBuffer.toString(“base64”);
Note: This Question is unanswered, help us to find answer for this one
Which method of fs module is used to truncate a file?
Correct Answer:
fs.ftruncate(fd, len, callback)
Note: This Question is unanswered, help us to find answer for this one
What does the following line of code do? var http = require("http");
Correct Answer:
Both of the above
Note: This Question is unanswered, help us to find answer for this one
Which of the following is true about writable stream?
Correct Answer:
Both of the above.
Note: This Question is unanswered, help us to find answer for this one
Which code will return total system memory in bytes? os is included like this: const os = require('os');
Correct Answer:
os.totalmem()
Note: This Question is unanswered, help us to find answer for this one
What is the syntax to list all commands in REPL?
Correct Answer:
.help
Note: This Question is unanswered, help us to find answer for this one
REPL stands for :
Correct Answer:
Read Eval Print Loop
Note: This Question is unanswered, help us to find answer for this one
What is Callback?
Correct Answer:
Callback is an asynchronous equivalent for a function.
Note: This Question is unanswered, help us to find answer for this one
Which of the following methods alone will write a file in Node.js? (check all that apply)
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
Which of the following methods can be used to read the filenames of a directory?
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
Which function will delete a file?
Correct Answer:
fs.unlink(path,callback);
Note: This Question is unanswered, help us to find answer for this one
Which of the following method resolves an ip address to an array of hostnames?
Correct Answer:
dns.reverse(ip, callback)
Note: This Question is unanswered, help us to find answer for this one
Which of the following is true about Node.JS?
Correct Answer:
All of the above.
Note: This Question is unanswered, help us to find answer for this one
Which of the following is correct way to imports http module?
Correct Answer:
require('http')
Note: This Question is unanswered, help us to find answer for this one
How to add a listener to event emitter?
Correct Answer:
eventEmitter.on(‘event',connectHandler);
Note: This Question is unanswered, help us to find answer for this one
Which of the following NPM commands will install both dependencies and devDependencies of a given project?
Correct Answer:
depends on NODE_ENV environment variable
Note: This Question is unanswered, help us to find answer for this one
In which of the following areas, Node.js is not advised to be used?
Correct Answer:
CPU intensive applications
Note: This Question is unanswered, help us to find answer for this one
How can the output of one stream be provided as input to another stream?
Correct Answer:
stream1.pipe(stream2);
Note: This Question is unanswered, help us to find answer for this one
Which of the following code prints current directory?
Correct Answer:
console.log('Current directory: ' + process.cwd());
Note: This Question is unanswered, help us to find answer for this one
Which of the following can be used to access the environment variable?
Correct Answer:
process.env
Note: This Question is unanswered, help us to find answer for this one
The NODE_DEBUG environment variable specifically turns logs for the following core functionality?
Correct Answer:
fs
Note: This Question is unanswered, help us to find answer for this one
Which of the following methods will write "text" without a trailing new line?
Correct Answer:
process.stdout.write('text')
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Express
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
npm ls
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of above
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
watch
Note: This Question is unanswered, help us to find answer for this one
How to Terminate Node REPL using the following short key?
Correct Answer:
ctrl + c twice
Note: This Question is unanswered, help us to find answer for this one
Which of the following is not a HTTP method?
Correct Answer:
D. header
Note: This Question is unanswered, help us to find answer for this one
Which of the following statement is valid?
Correct Answer:
C. Both of the above
Note: This Question is unanswered, help us to find answer for this one
Which of the following code is valid to get a joint path?
Correct Answer:
A. path.join('/test0', 'test11', '2slashes/1slash', 'tab', '..')
Note: This Question is unanswered, help us to find answer for this one
Which of the following is operates asynchronous logic?
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
In express application you are handling the route '/user/:name'. How could you access the 'name' property?
Correct Answer:
req.params.name
Note: This Question is unanswered, help us to find answer for this one
Which of the following should not to use in NodeJS?
Correct Answer:
CPU Intensive Applications
Note: This Question is unanswered, help us to find answer for this one
Which of the following is the result of module.id ?
Correct Answer:
file name
Note: This Question is unanswered, help us to find answer for this one
Which of the following timers methods exists in Node.js?
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
Which of the following variables you can use in modules?
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
Which of the following classes is the parent for repl.REPLServer class?
Correct Answer:
readline.Interfase
Note: This Question is unanswered, help us to find answer for this one
Which of the libs are exists in Node Core Libraries?
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
Which of the following code print the name of operating system?
Correct Answer:
console.log('type : ' + os.type());
Note: This Question is unanswered, help us to find answer for this one
Which are the below NodeJS features?
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
Which of the following engine built of NodeJS framework/platform?
Correct Answer:
Google Chrome's JavaScript V8 Engine
Note: This Question is unanswered, help us to find answer for this one
Which of the following module require to create server for NodeJS?
Correct Answer:
http
Note: This Question is unanswered, help us to find answer for this one
Which of the following values is correct about how many lines defaults can be in NODE_REPL_HISTORY_SIZE?
Correct Answer:
1000
Note: This Question is unanswered, help us to find answer for this one
Which of the following commands exit from REPL?
Correct Answer:
double ctrl+c
Note: This Question is unanswered, help us to find answer for this one
Which of the following libs provides basic HTTP authentication for protecting data?
Correct Answer:
connect
Note: This Question is unanswered, help us to find answer for this one
Which of the following libs is using for debugging node-applications?
Correct Answer:
node-inspector
Note: This Question is unanswered, help us to find answer for this one
How would you start node with debugger?
Correct Answer:
node debug myscript.js
Note: This Question is unanswered, help us to find answer for this one
Which of the following values can return async functions?
Correct Answer:
Non of these
Note: This Question is unanswered, help us to find answer for this one
Which of the following statement is true about the fs module of Node?
Correct Answer:
Both of the above
Note: This Question is unanswered, help us to find answer for this one
What REST stands for?
Correct Answer:
Representational State Transfer
Note: This Question is unanswered, help us to find answer for this one
NodeJS includes a full-featured out-of-process debugging utility accessible via a which protocol?
Correct Answer:
TCP-based protocol
Note: This Question is unanswered, help us to find answer for this one
Which of the following file extensions supports Node Module System ?
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Route path: /train/from-:to Request URL: http://localhost:3000/train/AHM-BRD What should be request params?
Correct Answer:
{ "from": "AHM", "to": "BRD" }
Note: This Question is unanswered, help us to find answer for this one
Which of the following ways to create a child process?
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Which of the following files using for setting start point in deployment services?
Correct Answer:
PROCFILE
Note: This Question is unanswered, help us to find answer for this one
You are handling POST request to the server. Which express middleware gives access to the submitted form data?
Correct Answer:
bodyParser
Note: This Question is unanswered, help us to find answer for this one
What is the use of Underscore variable in REPL session?
Correct Answer:
To get the last result
Note: This Question is unanswered, help us to find answer for this one
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'); });
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
Which of the following flags working with npm?
Correct Answer:
-O
Note: This Question is unanswered, help us to find answer for this one
Which of the following command-line arguments to "npm install" will allow an NPM package's binaries to be run outside the project folder?
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
Which Node.js module can be used to get the IP address of the server the program is running on?
Correct Answer:
os
Note: This Question is unanswered, help us to find answer for this one
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); });
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
Which of the following statements is true about the console Object in Node.js?
Correct Answer:
"console.log" can take only a single argument.
Note: This Question is unanswered, help us to find answer for this one
Which of the following methods can be used to read the contents of a directory?
Correct Answer:
fs.readdir()
Note: This Question is unanswered, help us to find answer for this one
Which of the following statements are true about the child_process module in Node.js?
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
Which of the following statements are true about the module.exports object in Node.js?
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
Which of the following will open a file, then read its contents one line at a time?
Correct Answer:
fs.createReadStream()
Note: This Question is unanswered, help us to find answer for this one
Which of the following will open a file, then read its contents one line at a time?
Correct Answer:
__filename
Note: This Question is unanswered, help us to find answer for this one
Which of the following will synchronously check if a file/directory exists?
Correct Answer:
fs.existsSync()
Note: This Question is unanswered, help us to find answer for this one
Which of the following console commands will update all installed global packages to the latest available versions?
Correct Answer:
npm update -g
Note: This Question is unanswered, help us to find answer for this one
What does process.argv[1] contain?
Correct Answer:
The file path of the JavaScript file.
Note: This Question is unanswered, help us to find answer for this one
What does the following command do? npm view <package-name> version
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
Which of the following will copy a file in Node.js?
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
Correct Answer:
request
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of these.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
npm view express version
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
False
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Unix binary distributed
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
"1.2.3b"
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
5
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Yes, with a third party library
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
tls.connect()
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
process.argv[2]
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
4
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
require('util').log('message')
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
"connect": ">=2.5"
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
static
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
console.log( fs.readFileSync("file.txt") );
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Stream
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
res.render.title = "My App";
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
0
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
path
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
A writable Stream.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
express.cookieParser()
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
"name" and "version"
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
querystring
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Is on-par with a recent version of Chrome
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Print a stack trace and exit
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
popen(3)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
false
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
.exit
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
http_server.createServer(function(){});
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Yes, with third party server-side DOM module.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
EventEmitter
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
req.query.start
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
False
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
It is the object returned from a require() call
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
False
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Events-handlers
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Run JavaScript code in a sandbox environment
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
process.stdout.write
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Connect
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
EventEmitter
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
you will be dropped into the REPL
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Buffer
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
req.params.id
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
An Error object if an error has occured.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Joyent
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
require
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
This is a JS idiom for setting default arguments.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
return;
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
function( req, res, next){ ... next( err ); }
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Error
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
on()
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
fs
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
process.env.ENV_VARIABLE
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
REPL
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
node
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
true
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Assert
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
require('iModule').mObject();
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
http
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
JSON.parse();
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
as an application
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
setTimeout(fn, 1000)
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
routes.id
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
module.exports object
Note: This Question is unanswered, help us to find answer for this one
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/');
Correct Answer:
Server running at http://localhost:8000/
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
I/O-bound tasks
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
npm install
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of these.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
console.log
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
fs
Note: This Question is unanswered, help us to find answer for this one
In this code:
function myLog(err, data) {
console.log(err, data);
} fs.readFile('/tmp/sample', myLog);
The function 'myLog' is used as a(an):
Correct Answer:
Callback
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
require('dns');
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
breakpoints
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
I/O Bound Applications
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Listener
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
server
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Node Package Manager
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
--global
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
download the install
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
express
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Javascript
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
True
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of these
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of these.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Raw memory allocated outside the v8 heap
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Chrome's JavaScript runtime
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Object
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
util.log or console.log
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
var module = require('mymodule')
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
//comment
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
var
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
node example.js
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
console.log
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
peer
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
javascript
Note: This Question is unanswered, help us to find answer for this one
Node.js MCQs | Topic-wise