- How to enable v8 inspector for debugging and profiling?
- –inspect
- –inspect=<PORT NO>
- NodeJS is advised to be used for?
- Single Page Applications
- JSON APIs based Applications
- Data steaming applications
- Data Intensive Realtime Applications
- I/O bound applications
- NodeJS is not advised to be used for?
- CPU intensive applications
- What’s the code to print the name of Operating system?
- log(“type:” + os.type());
- What does REST stands for?
- Representational State Transfer
- Ways to create a child process in Nodejs?
- spawn()
- fork()
- exec()
- execFile()
- How to print current directory in Nodejs?
- log(‘Current directory’ + process.cwd());
- Which is package manager for Node?
- NPM
- Which framework includes input validation?
- Koa
- In Express application you handles the route ‘/user/:name’. How to access the property name?
- params.name
- For Linux, which environment variable is needed to set for successful NodeJS installation?
- Export PATH=$PATH:/usr/local/nodejs/bin
- Which file extensions supports Node module system?
- .js
- .node
- .json
- What will be the output of following code in console?
const EventEmitter = require(‘events’);
const myEve = new EventEmitter();
myEve.on(‘try’, () => {});
myEve.on(‘catch’, () => {});
const sym = Symbol(‘type’);
myEve.on(sym, () => {});
console.log(myEve.eventNames());
- Prints: [ ‘try’, ‘catch’, Symbol(type) ]
- Correct way to import http module?
- require(‘http’);
- If we have following construction in Express.js, which paths will match this route?
get(‘/ak+hm’, function (req, res) {
res.send(‘ak+hm’)
})
- akhm, akkhm, akkkhm, and so on
- Which of the commands exit from REPL?
- double ctrl + c
- ctrl + d
- Which method is used to check modifications in files?
- Watch
- True statements about the fs module of Node?
- Asynchronous methods of fs module take last parameter as completion function callback
- Every method in fs module have synchronous as well as asynchronous form.
- How to convert from Buffer instance to string of base64?
- toString(“base64”);
- Which variables can be used in modules?
- __filename
- __dirname
- Which engine built of NodeJs framework/platform?
- Google Chrome’s JavaScript V8 Engine
- Which utility modules are available in NodeJS?
- OS
- Path
- Net
- DNS
- Domain
- Which method will print to the console without a trailing new line?
- stdout.print()
- Which is most popular NodeJs framework?
- Express
- Which of the following is the result of module.id?
- File name
- Which method can be used to write a file in Node.js?
- createWriteStream()
- Which method of fs module is used to truncate a file?
- unlink(path, callback)
- Which are the debug commands to debug node server?
- node debug <test.js>
- node debug – p <pid>
- node debug <URI>
- Which console commands will update all installed global packages to the latest available versions?
- npm update –g
- How to access the environment variable, «ENV_VARIABLE» in Node.js?
- env.ENV_VARIABLE
- Which method can be used to read the contents of a directory?
- readdir()