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.
Question:- What is the difference between events and callbacks in Node.js?
Answer:- Although, Events and Callbacks look similar the differences lies in the fact that callback functions are called when an asynchronous function returns its result whereas event handling works on the observer pattern. Whenever an event gets fired, its listener function starts executing. Node.js has multiple in-built events available through the events module and EventEmitter class which is used to bind events and event listeners.
Question:- What is the Punycode in Node.js?
Answer:- The Punycode is an encoding syntax which is used to convert Unicode (UTF-8) string of characters to ASCII string of characters. It is bundled with Node.js v0.6.2 and later versions. If you want to use it with other Node.js versions, then use npm to install Punycode module first. You have to used require (Punycode) to access it.
Question:- What does Node.js TTY module contains?
Answer:- The Node.js TTY module contains tty.ReadStream and tty.WriteStream classes. In most cases, there is no need to use this module directly. You have to used require (tty) to access this module.
Question:- What are the main differences between operational and programmer errors?
Answer:- The most crucial difference between operational and programmer errors is that the operational errors are not bugs but problems with the system such as to request timeout or hardware failure. On the other hand, the programmer errors are actual bugs in the application.
Question:- What do you understand by an EventEmitter in Node.js?
Answer:- In Node.js, an EventEmitter is a class that includes all the objects capable of emitting events. This can be achieved by attaching named events that are emitted by the object using an eventEmitter.on() function. Thus whenever this object throws an event, the attached functions are invoked synchronously.
Question:- What is the difference between readFile and createReadStream in Node.js?
Answer:- In Node.js, there are two ways to read and execute files: readFile and CreateStream. • The readFile() process is a fully buffered process that returns the response only when the complete file is pushed into the buffer and is read. This process is called a memory-intensive process, and in the case of large files, the processing can be very slow. • On the other hand, the createReadStream() is a partially buffered process that treats the entire process as an event series. The entire file is split into chunks and then processed and sent back as a response one by one. After completing this step, they are finally removed from the buffer. Unlike the readFile process, the createReadStream process is effective for the processing of large files.
Question:- What is the concept of Punycode in Node.js?
Answer:- In Node.js, the concept of Punycode is used for converting one type of string into another type. Punycode is an encoding syntax used for converting Unicode (UTF-8) string of characters into a basic ASCII string of characters. Now, the hostnames can only understand the ASCII characters so, after the Node.js version 0.6.2 onwards, it was bundled up with the default Node package.
Question:- In Node.js, the concept of Punycode is used for converting one type of string into another type. Punycode is an encoding syntax used for converting Unicode (UTF-8) string of characters into a basic ASCII string of characters. Now, the hostnames can only understand the ASCII characters so, after the Node.js version 0.6.2 onwards, it was bundled up with the default Node package.
Answer:- In Node.js, the concept of Punycode is used for converting one type of string into another type. Punycode is an encoding syntax used for converting Unicode (UTF-8) string of characters into a basic ASCII string of characters. Now, the hostnames can only understand the ASCII characters so, after the Node.js version 0.6.2 onwards, it was bundled up with the default Node package.
Question:- What is a thread pool in Node.js? Which library handles it?
Answer:- In Node.js, the libuv library is used to handle the Thread pool. The libuv library is a multi-platform C library that supports asynchronous I/O-based operations such as file systems, networking, and concurrency.
Question:- Explain what is Bootstrap?
Answer:- Bootstrap is a HTML, CSS, and JS framework for building the rich web applications with minimal effort. This framework emphasis more on building mobile web applications.
Question:- Explain why to choose Bootstrap for building the websites?
Answer:- There are few reason why we choose Bootstrap for building websites • Mobile Support: For mobile devices it provides full support in one single file rather than in separate file. It supports the responsive design including adjusting the CSS based on the different types of device, size of the screen etc. It reduces extra effort for developers. • Easy to learn: Writing application in bootstrap is easy if you know CSS and HTML • Browser Support: It supports all the popular browsers like Firefox, Opera, Safari, IE etc.
