Blog_Post 304
--
- What is “callback hell” and how can it be avoided?
Callbacks on callbacks nested in callbacks ect… Just a lot of callback functions with code in those callbacks that other callbacks are dependent on. Promises are one answer when it comes to asynchronous processes. Planning out the framework of your project ahead of time can also keep you from falling into the callback trap.
- What are “stubs” in Node.js?
Stubs are used to test, debug or build code, but are not meant for the final product. If you are running code that has high latency or there is a vital connection you temporarily cannot connect to, you can place a stub in your code to appease your codes dependencies, so you can troubleshoot.
- What are “streams” in Node.js?
It’s not just node JS. Think of “streaming” sites like Youtube or Netflix. They send small chunks of data at a time, rather than the whole video all at once. A file can also be larger than what memory you have available, and streaming helps solve this issue as well.
- What does “chaining” mean in Node.js?
Method chaining requires you to return an object (a reference to) containing the next method to call.
- Explain “console” in Node.js.
Node.js console is a global object and is used to print different levels of messages to stdout and stderr. There are built-in methods to be used for printing informational, warning, and error messages.
It is used in synchronous way when the destination is a file or a terminal and in asynchronous way when the destination is a pipe.
https://www.tutorialspoint.com/nodejs/nodejs_console.htm
- Explain exit codes in Node.js. List out some exit codes.
https://node.readthedocs.io/en/latest/api/process/
- What is the difference between cluster and non-cluster Index?
A clustered index defines the order in which data is physically stored in a table.
A non-clustered index doesn’t sort the physical data inside the table. In fact, a non-clustered index is stored at one place and table data is stored in another place.
- What are user defined functions? What are all types of user defined functions?
There can be 4 different types of user-defined functions, they are:
- Function with no arguments and no return value
- Function with no arguments and a return value
- Function with arguments and no return value
- Function with arguments and a return value