{
"iq":[{"id":"1",
"q":"What is Node.js?",
"answer":"Node.js is a very powerful JavaScript based platform or framework which is built on Google Chrome's JavaScript V8 Engine. "
},
{"id":"2",
"q":"Why to use Node.js? ",
"answer":"It is used to develop I/O intensive web applications like video streaming sites, single page applications (SPA) and other web applications. Node.js is open source and used by thousands of developers around the world. "
},
{"id":"3",
"q":"How node.js works ",
"answer":"Node.js works on a v8 environment, it is a virtual machine that utilizes JavaScript as its scripting language and achieves high output via non-blocking I/O and single threaded event loop."
},
{"id":"4",
"q":"What do you mean by the term I/O ? ",
"answer":"I/O is the shorthand for input and output, and it will access anything outside of your application. It will be loaded into the machine memory to run the program, once the application is started. "
},
{"id":"5",
"q":"What does event-driven programming mean? ",
"answer":"In computer programming, event driven programming is a programming paradigm in which the flow of the program is determined by events like messages from other programs or threads."
},
{"id":"6",
"q":"Where can we use node.js? ",
"answer":"Node.js shines in real-time web applications employing push technology over web sockets. It can be used for the following purposes: a) Web applications (especially real-time web apps) b) Network applications c) Distributed systems d) General purpose applications "
},
{"id":"7",
"q":"What are the two types of API functions in Node.js?",
"answer":"The two types of API functions in Node.js are:\n\na) Asynchronous, non-blocking functions\n\nb) Synchronous, blocking functions "
},
{"id":"8",
"q":"What is control flow function? ",
"answer":"A generic piece of code which runs in between several asynchronous function calls is known as control flow function."
},
{"id":"9",
"q":"Explain the steps how “Control Flow” controls the functions calls? ",
"answer":"Control the order of execution -> Collect data -> Limit concurrency -> Call the next step in program"
},
{"id":"10",
"q":"Why Node.js is single threaded? ",
"answer":"For async processing, Node.js was created explicitly as an experiment.It is believed that more performance and scalability can be achieved by doing async processing on a single thread under typical web loads than the typical thread based implementation."
},
{"id":"11",
"q":"Explain NPM in Node.js?",
"answer":"NPM stands for Node Package Manager (npm) and there are two functionalities which NPM takes care of mainly and they are –\n\nOnline repositories for node.js modules or packages, which can be searched on search.nodejs.org\n\nDependency Management, Version Management and command line utility for installing Node.js packages."
},
{"id":"12",
"q":"Mention command to verify the NPM version in Node.js?",
"answer":"$ npm --version"
},
{"id":"13",
"q":"Explain callback in Node.js?",
"answer":" Callback is called once the asynchronous operation has been completed. Node.js heavily uses callbacks and all API’s of Node.js are written to support callbacks."
},
{"id":"14",
"q":"How Node.js can be made more scalable?",
"answer":" Node.js works good for I/O bound and not CPU bound work. For instance if there is a function to read a file, file reading will be started during that instruction and then it moves onto next instruction and once the I/O is done or completed it will call the callback function. So there will not be any blocking."
},
{"id":"15",
"q":"Explain global installation of dependencies? ",
"answer":"Globally installed dependencies or packages are stored in <user-directory>/npm directory and these dependencies can be used in Command Line Interface function of any node.js."
},
{"id":"16",
"q":"Can a user access DOM in a Node?",
"answer":"No, you cannot access DOM. "
},
{"id":"17",
"q":"In Node.js, how do you access the last expression?",
"answer":"We have to use the underscore (_) character to access the last expression. "
},
{"id":"18",
"q":"Explain Package.JSON?",
"answer":"This will be present in the root directory of any Node module/application and will be used to define the properties of a package."
},
{"id":"19",
"q":"Explain “Callback hell”? ",
"answer":"“Callback hell” will be referred to heavily nested callbacks which has become unreadable or unwieldly. "
},
{"id":"20",
"q":"What are “Streams” in Node.JS?",
"answer":"“Streams” are objects which will let you read the data from source and write data to destination as a continuous process. "
},
{"id":"21",
"q":"Explain REPL In Node.Js?",
"answer":"The REPL stands for “Read Eval Print Loop”. It is a simple program that accepts the commands, evaluates them, and finally prints the results. REPL provides an environment similar to that of Unix/Linux shell or a window console, in which we can enter the command and the system, in turn, responds with the output. REPL performs the following tasks.\n\n READ\n\nIt Reads the input from the user, parses it into JavaScript data structure and then stores it in the memory.\n\nEVAL\\n\nIt Executes the data structure.\n\nPRINT\n\nIt Prints the result obtained after evaluating the command.\\n\nLOOP\n\nIt Loops the above command until the user presses Ctrl+C two times. "
},
{"id":"22",
"q":"How To Get Post Data In Node.Js? ",
"answer":" app.use(express.bodyParser());\n\napp.post('/', function(request, response){\n\nconsole.log(request.body.user);\n\n }); "
},
{"id":"23",
"q":"How To Make Post Request In Node.Js?",
"answer":"var request = require('request');\n\nrequest.post(\n\n'http://www.example.com/action',\n\n{ form: { key: 'value' } },\n\nfunction (error, response, body) {\n\nif (!error && response.statusCode == 200) {\n\nconsole.log(body)\n\n}\n\n }\n\n);"
},{"id":"24",
"q":"What Is EventEmitter In Node.Js? ",
"answer":"Events module in Node.js allows us to create and handle custom events. The Event module contains “EventEmitter” class which can be used to raise and handle custom events. It is accessible via the following code.\n\nvar events = require('events');\n\nvar eventEmitter = new events.EventEmitter();When an EventEmitter instance encounters an error, it emits an “error” event. When a new listener gets added, it fires a “newListener” event and when a listener gets removed, it fires a “removeListener” event.EventEmitter provides multiple properties like “on” and “emit”. The “on” property is used to bind a function to the event and “emit” is used to fire an event."
},{"id":"25",
"q":"What Is NPM In Node.Js? ",
"answer":"NPM stands for Node Package Manager. It provides following two main functionalities.\n\nIt works as an Online repository for node.js packages/modules which are present at <nodejs.org>.\n\nIt works as Command line utility to install packages, do version management and dependency management of Node.js packages.\n\nNPM comes bundled along with Node.js installable. We can verify its version using the following command-\n\n$ npm --version\n\nNPM helps to install any Node.js module using the following command.\n\n$ npm install <Module Name>\n\nFor example, following is the command to install a famous Node.js web framework module called express-\n\n$ npm install express"
},{"id":"26",
"q":"What Is The Global Installation Of Dependencies?",
"answer":"Globally installed packages/dependencies are stored in <user-directory>/npm directory. Such dependencies can be used in CLI (Command Line Interface) function of any node.js, but cannot be imported using require() in the Node application directly.\n\nTo install a Node project globally use -g flag as.\n\n C:\Nodejs_WorkSpace>npm install express -g"
},{"id":"27",
"q":"What Is Package.Json?",
"answer":"It is a plain JSON (JavaScript Object Notation) text file which contains all metadata information about Node.js Project or application.\n\nThis file should be present in the root directory of every Node.js Package or Module to describe its metadata in JSON format.\n\nThe file is named as “package” because Node.js platform treats every feature as a separate component. Node.js calls these as Package or Module."
},{"id":"28",
"q":"What Is Chaining Process In Node.Js?",
"answer":" It’s an approach to connect the output of one stream to the input of another stream, thus creating a chain of multiple stream operations."
},{"id":"29",
"q":"What Is A Child_process Module In Node.Js? ",
"answer":"Node.js supports the creation of child processes to help in parallel processing along with the event-driven model.\n\nThe Child processes always have three streams <child.stdin>, child.stdout, and child.stderr. The <stdio> stream of the parent process shares the streams of the child process.\n\nNode.js provides a <child_process> module which supports following three methods to create a child process.\n\nexec – <child_process.exec> method runs a command in a shell/console and buffers the output.\n\nspawn – <child_process.spawn> launches a new process with a given command.\\n\nfork – <child_process.fork> is a special case of the spawn() method to create child processes."
},{"id":"30",
"q":"In Node.js, which command is used to import external libraries? ",
"answer":"A command called “require” is used for importing external libraries."
},{"id":"31",
"q":"What you mean by chaining in Node.JS? ",
"answer":"It’s a mechanism in which output of one stream will be connected to another stream and thus creating a chain of multiple stream operations."
},{"id":"32",
"q":"Explain Child process module?",
"answer":"AChild process module has following three major ways to create child processes –\n\nspawn - child_process.spawn launches a new process with a given command.\n\nexec - child_process.exec method runs a command in a shell/console and buffers the output.\\n\nfork - The child_process.fork method is a special case of the spawn() to create child processes. "
},{"id":"33",
"q":"Why to use exec method for Child process module?",
"answer":"exec method runs a command in a shell and buffers the output. Below is the command –child_process.exec(command[, options], callback) "
},{"id":"34",
"q":"What is the use of method – “spawn()”?",
"answer":"This method is used to launch a new process with the given commands. Below is the method signature –child_process.spawn(command[, args][, options])"
},{"id":"35",
"q":"What is the use of method – “fork()”?",
"answer":"This method is a special case for method- “spawn()” for creating node processes. The method signature –child_process.fork(modulePath[, args][, options])"
},
{
"id": "36",
"q": "Explain Piping Stream?",
"answer": "Whenever we want to display the collection of images in a rotation manner one by one then we will go for Adrotator control.This is a mechanism of connecting one stream to other and this is basically used for getting the data from one stream and pass the output of this to other stream."
},{"id":"37",
"q":"What would be the limit for Piping Stream?",
"answer":"There will not be any limit for piping stream."
},{"id":"38",
"q":"Explain FS module ?",
"answer":"Here FS stands for “File System” and fs module is used for File I/O. FS module can be imported in the following way –\n\nvar test = require(\"fs\")"
},{"id":"39",
"q":"Explain “Console” in Node.JS? ",
"answer":"“Console” is a global object and will be used for printing to stderr and stdout and this will be used in synchronous manner in case of destination is either file or terminal or else it is used in asynchronous manner when it is a pipe."
},{"id":"40",
"q":"Define OS module? ",
"answer":"OS module is used for some basic operating system related utility functions. Below is the syntax for importing OS module –\n\nvar MyopSystem = require(\"os\")"
},{"id":"41",
"q":"NodeJS is client side server side language? ",
"answer":"NodeJS is a runtime system, which is used for creating server-side applications."
},{"id":"42",
"q":"In which scenarios NodeJS works well?",
"answer":"NodeJS is not appropriate to use in scenarios where single-threaded calculations are going to be the holdup."
},{"id":"43",
"q":"Explain “Stub”?",
"answer":"Stub is a small program, which substitutes for a longer program, possibly to be loaded later and that is located remotely. Stubs are functions/programs that simulate the behaviors of components/modules."
},{"id":"44",
"q":"Explain “Buffer class” in Node.JS?",
"answer":"It is a global class which can be accessed in an application without importing buffer modules."
},{"id":"45",
"q":"What is the difference between Node.js vs Ajax? ",
"answer":"The difference between Node.js and Ajax is that, Ajax (short for Asynchronous Javascript and XML) is a client side technology, often used for updating the contents of the page without refreshing it. While,Node.js is Server Side Javascript, used for developing server software. Node.js does not execute in the browser but by the server."
},{"id":"46",
"q":"How Node.js overcomes the problem of blocking of I/O operations?",
"answer":"Node.js solves this problem by putting the event based model at its core, using an event loop instead of threads. "
},{"id":"47",
"q":"Mention the steps by which you can async in Node.js?",
"answer":" By following steps you can async Node.js : First class functions -> Function composition -> Callback Counters -> Event loops"
},{"id":"48",
"q":"What is an event loop in Node.js ? ",
"answer":"To process and handle external events and to convert them into callback invocations an event loop is used. So, at I/O calls, node.js can switch from one request to another . "
},{"id":"49",
"q":"Why node.js is quickly gaining attention from JAVA programmers? ",
"answer":"Node.js is quickly gaining attention as it is a loop based server for JavaScript.Node.js gives user the ability to write the JavaScript on the server,which has access to things like HTTP stack, file I/O, TCP and databases. "
},{"id":"50",
"q":"What is ‘Callback’ in node.js? ",
"answer":"Callback function is used in node.js to deal with multiple requests made to the server.Like if you have a large file which is going to take a long time for a server to read and if you don’t want a server to get engage in reading that large file while dealing with other requests, call back function is used. Call back function allows the server to deal with pending request first and call a function when it is finished."
},{"id":"51",
"q":"List the steps involved in the Control Flow function. ",
"answer":"Control the order of execution à Collect data à Limit concurrency à Call the next program step "
},
{"id":"52",
"q":"Can a user access DOM in a Node?",
"answer":"No, you cannot access DOM. "
},{"id":"53",
"q":"In Node.js, how do you access the last expression? ",
"answer":"We have to use the underscore (_) character to access the last expression. "
},{"id":"54",
"q":"How to copy buffers in NodeJS?",
"answer":"buffer.copy(targetBuffer[, targetStart][, sourceStart][, sourceEnd])"
},{"id":"55",
"q":"Why to use “__filename” in Node.JS? ",
"answer":"“__filename” is used to represent the filename of the code which is being executed. It used to resolve the absolute path of file. Below is the sample code for the same –\n\nConsole.log(__filename);"
},{"id":"56",
"q":"Why to use “ClearTimeout” in Node.JS?",
"answer": "This is the global function and it is used to stop a timer which was created during “settimeout()”."
},{"id":"57",
"q":"Explain Web Server? ",
"answer":"It is a software app which will handle the HTTP requests by client (eg: browser) and will return web pages to client as a response. Most of web server supports – server side scripts using scripting languages. Example of web server is Apache, which is mostly used webserver."
},{"id":"58",
"q":"Explain “Event Emitter” in Node.JS? ",
"answer":"It is a part of Events module. When instance of EventEmitter faces any error, it will emit an 'error' event. “Event Emitters” provides multiple properties like – “emit” and “on”.\n\n“on” property is used for binding the function with event.\n\n“emit” property is used for firing an event."
},{"id":"59",
"q":" Why to use Net.socket in Node.JS?",
"answer":"This object is an abstraction of a local socket or TCP. net.Socket instances implement a duplex Stream interface. These can be created by the user and used as a client (with connect() function) or they can be created by Node and can be passed to the user through the 'connection' event of a server."
},{"id":"60",
"q":"What is the biggest drawback of Node.js? ",
"answer":"The biggest drawback is the fact that it is challenging to have one process with a single thread to scale up on multi core servers. "
}
]
}
"iq":[{"id":"1",
"q":"What is Node.js?",
"answer":"Node.js is a very powerful JavaScript based platform or framework which is built on Google Chrome's JavaScript V8 Engine. "
},
{"id":"2",
"q":"Why to use Node.js? ",
"answer":"It is used to develop I/O intensive web applications like video streaming sites, single page applications (SPA) and other web applications. Node.js is open source and used by thousands of developers around the world. "
},
{"id":"3",
"q":"How node.js works ",
"answer":"Node.js works on a v8 environment, it is a virtual machine that utilizes JavaScript as its scripting language and achieves high output via non-blocking I/O and single threaded event loop."
},
{"id":"4",
"q":"What do you mean by the term I/O ? ",
"answer":"I/O is the shorthand for input and output, and it will access anything outside of your application. It will be loaded into the machine memory to run the program, once the application is started. "
},
{"id":"5",
"q":"What does event-driven programming mean? ",
"answer":"In computer programming, event driven programming is a programming paradigm in which the flow of the program is determined by events like messages from other programs or threads."
},
{"id":"6",
"q":"Where can we use node.js? ",
"answer":"Node.js shines in real-time web applications employing push technology over web sockets. It can be used for the following purposes: a) Web applications (especially real-time web apps) b) Network applications c) Distributed systems d) General purpose applications "
},
{"id":"7",
"q":"What are the two types of API functions in Node.js?",
"answer":"The two types of API functions in Node.js are:\n\na) Asynchronous, non-blocking functions\n\nb) Synchronous, blocking functions "
},
{"id":"8",
"q":"What is control flow function? ",
"answer":"A generic piece of code which runs in between several asynchronous function calls is known as control flow function."
},
{"id":"9",
"q":"Explain the steps how “Control Flow” controls the functions calls? ",
"answer":"Control the order of execution -> Collect data -> Limit concurrency -> Call the next step in program"
},
{"id":"10",
"q":"Why Node.js is single threaded? ",
"answer":"For async processing, Node.js was created explicitly as an experiment.It is believed that more performance and scalability can be achieved by doing async processing on a single thread under typical web loads than the typical thread based implementation."
},
{"id":"11",
"q":"Explain NPM in Node.js?",
"answer":"NPM stands for Node Package Manager (npm) and there are two functionalities which NPM takes care of mainly and they are –\n\nOnline repositories for node.js modules or packages, which can be searched on search.nodejs.org\n\nDependency Management, Version Management and command line utility for installing Node.js packages."
},
{"id":"12",
"q":"Mention command to verify the NPM version in Node.js?",
"answer":"$ npm --version"
},
{"id":"13",
"q":"Explain callback in Node.js?",
"answer":" Callback is called once the asynchronous operation has been completed. Node.js heavily uses callbacks and all API’s of Node.js are written to support callbacks."
},
{"id":"14",
"q":"How Node.js can be made more scalable?",
"answer":" Node.js works good for I/O bound and not CPU bound work. For instance if there is a function to read a file, file reading will be started during that instruction and then it moves onto next instruction and once the I/O is done or completed it will call the callback function. So there will not be any blocking."
},
{"id":"15",
"q":"Explain global installation of dependencies? ",
"answer":"Globally installed dependencies or packages are stored in <user-directory>/npm directory and these dependencies can be used in Command Line Interface function of any node.js."
},
{"id":"16",
"q":"Can a user access DOM in a Node?",
"answer":"No, you cannot access DOM. "
},
{"id":"17",
"q":"In Node.js, how do you access the last expression?",
"answer":"We have to use the underscore (_) character to access the last expression. "
},
{"id":"18",
"q":"Explain Package.JSON?",
"answer":"This will be present in the root directory of any Node module/application and will be used to define the properties of a package."
},
{"id":"19",
"q":"Explain “Callback hell”? ",
"answer":"“Callback hell” will be referred to heavily nested callbacks which has become unreadable or unwieldly. "
},
{"id":"20",
"q":"What are “Streams” in Node.JS?",
"answer":"“Streams” are objects which will let you read the data from source and write data to destination as a continuous process. "
},
{"id":"21",
"q":"Explain REPL In Node.Js?",
"answer":"The REPL stands for “Read Eval Print Loop”. It is a simple program that accepts the commands, evaluates them, and finally prints the results. REPL provides an environment similar to that of Unix/Linux shell or a window console, in which we can enter the command and the system, in turn, responds with the output. REPL performs the following tasks.\n\n READ\n\nIt Reads the input from the user, parses it into JavaScript data structure and then stores it in the memory.\n\nEVAL\\n\nIt Executes the data structure.\n\nPRINT\n\nIt Prints the result obtained after evaluating the command.\\n\nLOOP\n\nIt Loops the above command until the user presses Ctrl+C two times. "
},
{"id":"22",
"q":"How To Get Post Data In Node.Js? ",
"answer":" app.use(express.bodyParser());\n\napp.post('/', function(request, response){\n\nconsole.log(request.body.user);\n\n }); "
},
{"id":"23",
"q":"How To Make Post Request In Node.Js?",
"answer":"var request = require('request');\n\nrequest.post(\n\n'http://www.example.com/action',\n\n{ form: { key: 'value' } },\n\nfunction (error, response, body) {\n\nif (!error && response.statusCode == 200) {\n\nconsole.log(body)\n\n}\n\n }\n\n);"
},{"id":"24",
"q":"What Is EventEmitter In Node.Js? ",
"answer":"Events module in Node.js allows us to create and handle custom events. The Event module contains “EventEmitter” class which can be used to raise and handle custom events. It is accessible via the following code.\n\nvar events = require('events');\n\nvar eventEmitter = new events.EventEmitter();When an EventEmitter instance encounters an error, it emits an “error” event. When a new listener gets added, it fires a “newListener” event and when a listener gets removed, it fires a “removeListener” event.EventEmitter provides multiple properties like “on” and “emit”. The “on” property is used to bind a function to the event and “emit” is used to fire an event."
},{"id":"25",
"q":"What Is NPM In Node.Js? ",
"answer":"NPM stands for Node Package Manager. It provides following two main functionalities.\n\nIt works as an Online repository for node.js packages/modules which are present at <nodejs.org>.\n\nIt works as Command line utility to install packages, do version management and dependency management of Node.js packages.\n\nNPM comes bundled along with Node.js installable. We can verify its version using the following command-\n\n$ npm --version\n\nNPM helps to install any Node.js module using the following command.\n\n$ npm install <Module Name>\n\nFor example, following is the command to install a famous Node.js web framework module called express-\n\n$ npm install express"
},{"id":"26",
"q":"What Is The Global Installation Of Dependencies?",
"answer":"Globally installed packages/dependencies are stored in <user-directory>/npm directory. Such dependencies can be used in CLI (Command Line Interface) function of any node.js, but cannot be imported using require() in the Node application directly.\n\nTo install a Node project globally use -g flag as.\n\n C:\Nodejs_WorkSpace>npm install express -g"
},{"id":"27",
"q":"What Is Package.Json?",
"answer":"It is a plain JSON (JavaScript Object Notation) text file which contains all metadata information about Node.js Project or application.\n\nThis file should be present in the root directory of every Node.js Package or Module to describe its metadata in JSON format.\n\nThe file is named as “package” because Node.js platform treats every feature as a separate component. Node.js calls these as Package or Module."
},{"id":"28",
"q":"What Is Chaining Process In Node.Js?",
"answer":" It’s an approach to connect the output of one stream to the input of another stream, thus creating a chain of multiple stream operations."
},{"id":"29",
"q":"What Is A Child_process Module In Node.Js? ",
"answer":"Node.js supports the creation of child processes to help in parallel processing along with the event-driven model.\n\nThe Child processes always have three streams <child.stdin>, child.stdout, and child.stderr. The <stdio> stream of the parent process shares the streams of the child process.\n\nNode.js provides a <child_process> module which supports following three methods to create a child process.\n\nexec – <child_process.exec> method runs a command in a shell/console and buffers the output.\n\nspawn – <child_process.spawn> launches a new process with a given command.\\n\nfork – <child_process.fork> is a special case of the spawn() method to create child processes."
},{"id":"30",
"q":"In Node.js, which command is used to import external libraries? ",
"answer":"A command called “require” is used for importing external libraries."
},{"id":"31",
"q":"What you mean by chaining in Node.JS? ",
"answer":"It’s a mechanism in which output of one stream will be connected to another stream and thus creating a chain of multiple stream operations."
},{"id":"32",
"q":"Explain Child process module?",
"answer":"AChild process module has following three major ways to create child processes –\n\nspawn - child_process.spawn launches a new process with a given command.\n\nexec - child_process.exec method runs a command in a shell/console and buffers the output.\\n\nfork - The child_process.fork method is a special case of the spawn() to create child processes. "
},{"id":"33",
"q":"Why to use exec method for Child process module?",
"answer":"exec method runs a command in a shell and buffers the output. Below is the command –child_process.exec(command[, options], callback) "
},{"id":"34",
"q":"What is the use of method – “spawn()”?",
"answer":"This method is used to launch a new process with the given commands. Below is the method signature –child_process.spawn(command[, args][, options])"
},{"id":"35",
"q":"What is the use of method – “fork()”?",
"answer":"This method is a special case for method- “spawn()” for creating node processes. The method signature –child_process.fork(modulePath[, args][, options])"
},
{
"id": "36",
"q": "Explain Piping Stream?",
"answer": "Whenever we want to display the collection of images in a rotation manner one by one then we will go for Adrotator control.This is a mechanism of connecting one stream to other and this is basically used for getting the data from one stream and pass the output of this to other stream."
},{"id":"37",
"q":"What would be the limit for Piping Stream?",
"answer":"There will not be any limit for piping stream."
},{"id":"38",
"q":"Explain FS module ?",
"answer":"Here FS stands for “File System” and fs module is used for File I/O. FS module can be imported in the following way –\n\nvar test = require(\"fs\")"
},{"id":"39",
"q":"Explain “Console” in Node.JS? ",
"answer":"“Console” is a global object and will be used for printing to stderr and stdout and this will be used in synchronous manner in case of destination is either file or terminal or else it is used in asynchronous manner when it is a pipe."
},{"id":"40",
"q":"Define OS module? ",
"answer":"OS module is used for some basic operating system related utility functions. Below is the syntax for importing OS module –\n\nvar MyopSystem = require(\"os\")"
},{"id":"41",
"q":"NodeJS is client side server side language? ",
"answer":"NodeJS is a runtime system, which is used for creating server-side applications."
},{"id":"42",
"q":"In which scenarios NodeJS works well?",
"answer":"NodeJS is not appropriate to use in scenarios where single-threaded calculations are going to be the holdup."
},{"id":"43",
"q":"Explain “Stub”?",
"answer":"Stub is a small program, which substitutes for a longer program, possibly to be loaded later and that is located remotely. Stubs are functions/programs that simulate the behaviors of components/modules."
},{"id":"44",
"q":"Explain “Buffer class” in Node.JS?",
"answer":"It is a global class which can be accessed in an application without importing buffer modules."
},{"id":"45",
"q":"What is the difference between Node.js vs Ajax? ",
"answer":"The difference between Node.js and Ajax is that, Ajax (short for Asynchronous Javascript and XML) is a client side technology, often used for updating the contents of the page without refreshing it. While,Node.js is Server Side Javascript, used for developing server software. Node.js does not execute in the browser but by the server."
},{"id":"46",
"q":"How Node.js overcomes the problem of blocking of I/O operations?",
"answer":"Node.js solves this problem by putting the event based model at its core, using an event loop instead of threads. "
},{"id":"47",
"q":"Mention the steps by which you can async in Node.js?",
"answer":" By following steps you can async Node.js : First class functions -> Function composition -> Callback Counters -> Event loops"
},{"id":"48",
"q":"What is an event loop in Node.js ? ",
"answer":"To process and handle external events and to convert them into callback invocations an event loop is used. So, at I/O calls, node.js can switch from one request to another . "
},{"id":"49",
"q":"Why node.js is quickly gaining attention from JAVA programmers? ",
"answer":"Node.js is quickly gaining attention as it is a loop based server for JavaScript.Node.js gives user the ability to write the JavaScript on the server,which has access to things like HTTP stack, file I/O, TCP and databases. "
},{"id":"50",
"q":"What is ‘Callback’ in node.js? ",
"answer":"Callback function is used in node.js to deal with multiple requests made to the server.Like if you have a large file which is going to take a long time for a server to read and if you don’t want a server to get engage in reading that large file while dealing with other requests, call back function is used. Call back function allows the server to deal with pending request first and call a function when it is finished."
},{"id":"51",
"q":"List the steps involved in the Control Flow function. ",
"answer":"Control the order of execution à Collect data à Limit concurrency à Call the next program step "
},
{"id":"52",
"q":"Can a user access DOM in a Node?",
"answer":"No, you cannot access DOM. "
},{"id":"53",
"q":"In Node.js, how do you access the last expression? ",
"answer":"We have to use the underscore (_) character to access the last expression. "
},{"id":"54",
"q":"How to copy buffers in NodeJS?",
"answer":"buffer.copy(targetBuffer[, targetStart][, sourceStart][, sourceEnd])"
},{"id":"55",
"q":"Why to use “__filename” in Node.JS? ",
"answer":"“__filename” is used to represent the filename of the code which is being executed. It used to resolve the absolute path of file. Below is the sample code for the same –\n\nConsole.log(__filename);"
},{"id":"56",
"q":"Why to use “ClearTimeout” in Node.JS?",
"answer": "This is the global function and it is used to stop a timer which was created during “settimeout()”."
},{"id":"57",
"q":"Explain Web Server? ",
"answer":"It is a software app which will handle the HTTP requests by client (eg: browser) and will return web pages to client as a response. Most of web server supports – server side scripts using scripting languages. Example of web server is Apache, which is mostly used webserver."
},{"id":"58",
"q":"Explain “Event Emitter” in Node.JS? ",
"answer":"It is a part of Events module. When instance of EventEmitter faces any error, it will emit an 'error' event. “Event Emitters” provides multiple properties like – “emit” and “on”.\n\n“on” property is used for binding the function with event.\n\n“emit” property is used for firing an event."
},{"id":"59",
"q":" Why to use Net.socket in Node.JS?",
"answer":"This object is an abstraction of a local socket or TCP. net.Socket instances implement a duplex Stream interface. These can be created by the user and used as a client (with connect() function) or they can be created by Node and can be passed to the user through the 'connection' event of a server."
},{"id":"60",
"q":"What is the biggest drawback of Node.js? ",
"answer":"The biggest drawback is the fact that it is challenging to have one process with a single thread to scale up on multi core servers. "
}
]
}