Question:- How "Control Flow" controls the functions calls?
Answer:- The control flow does the following job: • Control the order of execution • Collect data • Limit concurrency • Call the next step in a program
Question:- Is it possible to access DOM in Node?
Answer:- No, it is not possible to access DOM in Node.
Question:- What types of tasks can be done asynchronously using the event loop?
Answer:- • I/O operations • Heavy computation • Anything requiring blocking
Question:- What is REPL in Node.js?
Answer:- REPL stands for Read Eval Print Loop. It specifies a computer environment like a window console or Unix/Linux shell where you can enter a command, and the computer responds with an output. It is very useful in writing and debugging the codes. REPL environment incorporates Node.js.
Question:- Explain the tasks of terms used in Node REPL.
Answer:- Following are the terms used in REPL with their defined tasks: • Read: It reads users input; parse the input into JavaScript data-structure and stores in memory. • Eval: It takes and evaluates the data structure. • Print: It is used to print the result. • Loop: It loops the above command until user press ctrl-c twice to terminate.
Question:- Is it possible to evaluate simple expressions using Node REPL?
Answer:- Yes. You can evaluate simple expressions using Node REPL.
Question:- Does Node.js supports cryptography?
Answer:- Yes, Node.js Crypto module supports cryptography. It provides cryptographic functionality that includes a set of wrappers for open SSLs hash HMAC, cipher, decipher, sign and verify functions.
Question:- What is npm? What is the main functionality of npm?
Answer:- npm stands for Node Package Manager. Following are the two main functionalities of npm: • Online repositories for node.js packages/modules which are searchable on search.nodejs.org • Command line utility to install packages, do version management and dependency management of Node.js packages.
Question:- What tools can be used to assure a consistent style in Node.js?
Answer:- Following is a list of tools that can be used in developing code in teams, to enforce a given style guide and to catch common errors using static analysis. • JSLint • JSHint • ESLint • JSCS
Question:- What is the difference between operational and programmer errors?
Answer:- Operational errors are not bugs, but create problems with the system like request timeout or hardware failure. On the other hand, programmer errors are actual bugs.
Question:- What is the difference between the global installation of dependencies and local installation of dependencies?
Answer:- • Global installation of dependencies is stored in /npm directory. While local installation of dependencies stores in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present. • Globally deployed packages cannot be imported using require() in Node application directly. On the other hand, locally deployed packages are accessible via require(). • To install a Node project globally -g flag is used. C:Nodejs_WorkSpace>npm install express ?g • To install a Node project locally, the syntax is: C:Nodejs_WorkSpace>npm install express
Question:- What is the role of assert in Node.js?
Answer:- The Node.js Assert is a way to write tests. It provides no feedback when running your test unless one fails. The assert module provides a simple set of assertion tests that can be used to test invariants. The module is intended for internal use by Node.js, but can be used in application code via require (assert).
Question:- What are the streams in Node.js?
Answer:- The Streams are the objects that facilitate you to read data from a source and write data to a destination. There are four types of streams in Node.js: • Readable: This stream is used for reading operations. • Writable: This stream is used for write operations. • Duplex: This stream can be used for both reading and write operations. • Transform: It is a type of duplex stream where the output computes according to input.
Question:- What is event-driven programming in Node.js?
Answer:- In Node.js, event-driven programming means as soon as Node starts its server, it initiates its variables, declares functions and then waits for an event to occur. It is one of the reasons why Node.js is pretty fast compared to other similar technologies.
