January 28, 2020

Top 20 Node.js Interview Questions and Answers

               Preparing for the Node js interview questions, you should start with the basic concepts to advanced topics and move up from down. It is important to understand how things work before moving on the more complex topics. To get the best understanding of Node.js, you must have a basic understanding of JavaScript related concepts as well.

 

Ques: 1. What can be the possible use of DNS module in Node.js?

Answer:

This is one of the most asked Node js interview questions. The DNS module consists of an asynchronous network wrapper. Let’s have a look at the most commonly used functions of this module:

1. DNS.lookup(address, options, callback) – This method takes any website’s address as its first parameter and returns the corresponding first IPV4 or IPV6 record. The options parameter can be an integer or object. If no options are provided both IPV4 and IPV6 are valid inputs. The third parameter is the callback functions.

2. DNS.lookupservice(address, port, callback) – This function converts any physical address to an array of record types. The record types are specified by the second parameter, rrbyte. The third method is the callback function.

3. dns.getServers() – This function returns an array of IP address strings that are currently configured for DNS resolution, formatted according to rfc5952. A string will include a port section if a custom port is used.

4. DNS.setServers() – This function sets the IP address and port of servers to be used when performing DNS resolution. The DNS.setServers() method must not be called while a DNS query is in progress.

AngularJS Interview Questions and Answers

Ques: 2. How can you use Timers in Node.js?

Answer:

As the name suggests, the Timer module executes code after a set period of time. It doesn’t need to be imported via require(). All the methods are available globally to emulate the browser JavaScript API which provides several ways of scheduling code to execute at a certain time.

The functions provided by Node.js for Timers are:

setTimeout(), setImmediate(), and setInterval.

AJAX interview Questions and Answers

Ques: 3. What do you mean by non-blocking mean in Node.js?

Answer:

If you are talking about non-blocking in Node.js, you are much aware about the non-blocking I/O.  It can be explained how Node uses libuv to handle its IO in a platform-agnostic way. A non-blocking request is made and upon a request, it queues it within the event loop. The JavaScript callback is then called on the main JavaScript thread.

JavaScript Interview Questions and Answers

Ques: 4. What is the main difference between Node.js and Ajex?

Answer:

The easiest way to explain the difference between Node.js and Ajax is that Node is a server-side JavaScript, while Ajax is a client-side technology. What that means is that Ajax is often used for updating the contents of the page without refreshing it. Node, on the other hand, is used for developing server software, executed by the server rather than in the browser.

JQuery Interview Questions and Answers

Ques: 5. What are the various pros and cons of Node.js?

Answer:

Let’s take a look at the most important pros and cons:

Pros: 

  • In the cases when your app doesn’t have any CPU intensive computation, you can build the whole thing in Javascript, including the basic database level. All you have to do is use  JSON storage object DB like MongoDB. 
  • Crawlers receive a full-rendered HTML response which is great for SEO.

Cons: 

  • Node.js responsiveness is blocked by an intensive CPU computation so a threaded platform would a better approach in those cases. 
  • Using a relational database with Node.js is considered less favourable.

Advance Java interview Questions and Answers

Ques: 6. What is the use of method spawn() and fork()?

Answer:

The spawn method is used when a new process is to be launched with a given set of commands. Check out the following command:

child_process.spawn(command[, args][, options])

The fork method is considered to be a special case for spawn() method. The following code shows how to use it:

child_process.fork(modulePath[, args][, options])


Ques: 7. Can you explain the EventEmitter in Node.js?

Answer:

EventMitter class for event module helps with raising and handling custom events. You can access it with the following code:

// Import events module

var events = require(‘events’);

// Create an eventEmitter object

var eventEmitter = new events.EventEmitter();


Ques: 8. What do you understand by tracing?

Answer:

The purpose of tracing is to trace information generated by V8. To enable it, pass flag-trace-events-enabled when starting the node.

All recorded categories can be specified by the flag–trace-event categories. The enabled logs can be opened as chrome://tracing in Chrome.

 

Ques: 9. Can you explain the control flow function and steps to execute it?

Answer:

The control flow function is the code that runs between asynchronous function calls. Following steps should be followed to execute it: 

  1. Control the order of execution. 
  2. Collect data. 
  3. Limit concurrency. 
  4. Call the next step in the program.

 

Ques: 10. What is the file system module of Node js?

Answer:

The file system module performs a file-related operation. It comprises synchronous and asynchronous functions to read/write files.

For instance, readFile() function is asynchronous function to read file content from specified path and readFileSync() is synchronous function to read files.

 

Ques: 11. What are some of the most popular modules of Node.js?

Answer:

The most popular modules Nodes.js are:

  • xpress 
  • async 
  • browserify 
  • socket.io 
  • bower 
  • gulp 
  • grunt

 

Ques: 12. What do you understand by package.json in node.js? What is it used for?

Answer:

Package.json holds various metadata information about the project. The information contained in this file is then given to npm to identify the project and to handle its dependencies.  

Some of the fields are name, description, author, and dependencies.

The dependencies are then installed whenever the project is installed through npm. Moreover, if the npm install is run in the root directory of the project, the dependencies will be installed in ./node_modules directory.

 

Ques: 13. What is the difference between Asynchronous and Non-blocking?

Answer:

Asynchronous or simply not synchronous means that the HTTP requests are not waiting for the server response. You can continue with other block and respond to the server response when received.

Non-Blocking, on the other hand, is a term commonly used with IO. For instance, non-blocking read/write calls return and expect the caller to call again. Read will wait until it has some data and put calling thread to sleep.


Ques: 14. What are the features of Node.js?

Answer:

Since the APIs of Node.js library are asynchronous, they are non-blocking which means that a Node.js based server never waits for an API to return data. Node.js is a system built on Google Chrome’s V8 JavaScript Engine which makes it very fast.

This system uses a single threaded model with event looping. With the event mechanism helping the server respond in a non-blocking way, the server is highly scalable compared to the other servers that create limited threads to handle requests.

 

Ques: 15. Why should you use Node.js?

Answer:

One could use Node.js when they want to easily build scalable apps. The biggest pros include:

  • It is very fast in code execution.
  • It is asynchronous and event-driven.
  • It is single-threaded but highly scalable.
  • No buffering.


Ques: 16. Explain the role of REPL in Node.js.?

Answer:

REPL stands for Read, Evaluate, Print, Loop – and it performs all the mentioned tasks accordingly. It is used to execute ad-hoc JavaScript statements and it is a very important part of the testing and debugging process.

 

Ques: 17. What is libuv library? And what is its use in Node.js?

Answer:

Libuv is a multi-platform support library with a focus on asynchronous I/O. Although it was primarily developed for Node.js, it’s also commonly used by other systems such as Luvit, Julia, pyuv etc.

Back in the days when the whole Node project started, it was using Google’s V8 and Marc Lehmann’s libev. However, the problem with libev was that it ran only on Unix so they had to come up with the new solution to make it work on Windows, especially once node.js grew in popularity.

Libuv was an abstraction around libev or IOCP depending on the platform, providing users an API based on libev. In the node-v0.9.0 version of libuv, libev was removed.

Here are some of the key features:

  • Full-featured event loop backed by epoll, kqueue, IOCP, event ports. 
  • Asynchronous TCP and UDP sockets. 
  • Asynchronous file and file system operations.
  • Child processes.
  • File system events.


Ques: 18. What are the two arguments that async.queue takes?

Answer:

These two arguments are:

a)      Task function

b)      Concurrency value

 

Ques: 19. How to avoid Callback Hell?

Answer:

Basically, every time a long-running query finishes its execution, the callback associated with the query is run. Since Node.js uses single thread only, it happens that it leads to numerous queued events. And that is where the callback comes in.

There are 4 common solutions for this issue:

Modular code – the code split into smaller modules that are later joined together to the main module again

Promise mechanism – ensures either a result or error; it’s an alternative way for the async code and it takes two optional arguments, one of which is called depending on the state of promise

Use of generators – they wait and resume using the yield keyword but can also suspend and resume async operations.

Async mechanism – the module with <async.waterfall> API which passes data from one operation to another using the next callback.

 

Ques: 20. What isNPM?

Answer:

NPM stands for Node Package Manager. It has 2 important functions:

It works on Online Repository for node.ls packages which are present at <nodejs.org>. In addition to that, it also works as a command line utility and does version management.

You can verify version using below command: npm –version.

To install any module you can use: npm install <Module Name>



January 15, 2020

Top 20 Unix interview Questions & Answers

Ques: 1. What is the Importance of writing Shell Scripts?

Ans: The points given below explain the importance of writing shell scripts. Shell script takes input from the user, file and displays it on the screen. Shell scripting is very useful in creating your own commands. It is helpful in automating some tasks of the day to day life. It is useful for automating system administration tasks. Mainly it saves time.


Ques: 2. What are the different Types of Shells available? 

Ans: There are mainly 4 important types of shells that are widely used. And they include:
  1. Bourne Shell (sh)
  2. C Shell (csh)
  3. Korn Shell (ksh)
  4. Bourne Again Shell (bash)

Ques: 3. What are the Advantages of C Shell over Bourne Shell?

Ans: The advantages of C Shell over Bourne Shell are:
  • C shell allows aliasing of commands i.e. a user can give any name of his choice to the command. This feature is mainly useful when a user has to type the lengthy command again and again. At that point of time, instead of typing a lengthy command a user can type the name that he has given.
  • C shell provides command history feature. C shell remembers the previously typed command. Thus, it avoids typing the command again and again.

Ques: 4. What are the two types of Shell Variables? Explain in brief.

Ans: The two types of shell variables are: 

1). Unix Defined Variables or System Variables – These are standard or shell defined variables. Generally, they are defined in CAPITAL letters. 

for example: SHELL – This is a Unix Defined or System Variable, which defines the name of the default working shell. 

2). User Defined Variables – These are defined by users. Generally, they are defined in lower letters. 

For example: $ a=10 –Here the user has defined a variable called ‘a’ and assigned value to it as 10.


Ques:5. What are positional parameters? Explain with an example.

Ans: Positional parameters are the variables defined by a shell. And they are used whenever we need to convey information to the program. And this can be done by specifying arguments at the command line.

There are totally 9 positional parameters present i.e. from $1 to $9.

Example: $ Test Indian IT Industry has grown very much faster

In the above statement, positional parameters are assigned like this.

$0 -> Test (Name of a shell program/script)
$1 ->Indian
$2 -> IT and so on.

Ques: 6. What are the three different security provisions provided by UNIX for a file or data?

Ans: Three different security provisions provided by UNIX for a file or data are:
  1. It provides a unique user id and password to the user, so that unknown or unauthorized person should not be able to access it.
  2. At file level, it provides security by providing read, write & execute permissions for accessing the files.
  3. Lastly, it provides security using file encryption. This method allows encoding a file in an unreadable format. Even if someone succeeds in opening a file, but they cannot read its contents until and unless it is decrypted.

Ques: 7. What are control instructions and how many types of control instructions are available in a shell? Explain in brief.

Ans: Control Instructions are the ones, which enable us to specify the order in which the various instructions in a program/script are to be executed by the computer. Basically, they determine a flow of control in a program.

There are 4 types of control instructions that are available in a shell:
  1. Sequence Control Instruction – This ensures that the instructions are executed in the same order in which they appear in the program.
  2. Selection or Decision Control Instruction – It allows the computer to take a decision as to which instruction is to be executed next. 
  3. Repetition or Loop Control Instruction – It helps a computer to execute a group of statements repeatedly. 
  4. Case-Control Instruction – This is used when we need to select from several alternatives.

Ques: 8. What are the two files of crontab command?

Ans: Two files of crontab command are:
  1. cron.allow – It decides which users need to be permitted from using crontab command. 
  2. cron.deny – It decides which users need to be prevented from using crontab command.

Ques: 9. What are the different commands available to check the disk usage?

Ans: There are three different commands available to check the disk usage. And they are:

  1. df – This command is used to check the free disk space.  
  2. du – This command is used to check the directory wise disk usage.  
  3. dfspace – This command is used to check the free disk space in terms of MB.

Ques: 10. What is Shebang in a shell script?

Ans: Shebang is a # sign followed by an exclamation i.e. !. Generally, this can be seen at the beginning or top of the script/program. Usually, a developer uses this to avoid repetitive work. Shebang mainly determines the location of the engine which is to be used in order to execute the script.

Here ‘#’ symbol is called as hash and ‘!’ is called a bang.

Example: #!/bin/bash

The above line also tells which shell to use.


Ques: 11. What is inode?

Ans. The inode is a data structure in a file system. Each inode is able to store the attributes and the location (s) of the disk block of the object’s data.


Ques: 12. What is the difference between Swapping and Paging?

Ans:

Swapping: Whole process is moved from the swap device to the main memory for execution. Process size must be less than or equal to the available main memory. It is easier to implementation and overhead to the system. Swapping systems does not handle the memory more flexibly as compared to the paging systems.

Paging: Only the required memory pages are moved to main memory from the swap device for execution. Process size does not matter. Gives the concept of the virtual memory. It provides greater flexibility in mapping the virtual address space into the physical memory of the machine. Allows more number of processes to fit in the main memory simultaneously. Allows the greater process size than the available physical memory. Demand paging systems handle the memory more flexibly.


Ques: 13. What is the difference between $* and $@?

Ans: $@ treats each quoted argument as separate arguments but $* will consider the entire set of positional parameters as a single string.


Ques: 14. Write down syntax for all loops in shell scripting ?
Ans: The syntax for all loops in unix:

for loop:

for i in $( ls ); do
echo item: $i
done

while loop:

#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 10 ]; do
echo The counter is $COUNTER
let COUNTER=COUNTER+1
done

until loop:

#!/bin/bash
COUNTER=20
until [ $COUNTER -lt 10 ]; do
echo COUNTER $COUNTER
let COUNTER-=1
done


Ques: 15. Can you link directories to hard links?

Ans: You cannot link directories to hard links and the reason behind it is quite technical. For now, you can learn that directories don’t fit into the system and essentially break it. So, in order to protect the file system structure, directories are avoided link with hard links.


Ques: 16. What are the security provisions provided by the Unix to protect the system?

Ans: In order to protect valuable information and files, Unix provides three key security provisions:
  1. It provides a unique ID and password to its every user so; no unauthorized access can be granted to anyone. 
  2. On each file, it offers read, writes and execute permission so, the user can grant permission he or she thinks is necessary to the third party. 
  3. Lastly the Unix offers security through the encryption which is one of the best ways to secure your file and data.

Ques: 17. Write down modes of operations in Vi editors and describe them?

Ans: Three significant modes of operation Vi include:
  • Insert mode: this mode will allow you to insert edit the existing text or add the new text in the command line. 
  • Command mode: in this mode, you can use the keyboard to make all the commands. 
  • The ex-command mode: with this mode, you can enter the command in the command line.

Ques: 18. If one process is inserting data into your MySQL database? How will you check how many rows inserted into every second?

Ans: Purpose of this Unix Command Interview is asking about "watch" command in UNIX which is repeatedly execute command provided with specified delay.


Ques: 19. What is break statement why do we use it?

Ans: The break refers to the command that is used whenever the user wants to directly jump out of the loop rather than following the path which leads back to the control command. Every single time break statement takes place in the program, the control automatically gets passed after the first line of command.


Ques 20: How will you run a process in background? How will you bring that into foreground and how will you kill that process?

Ans: For running a process in background use "&" in command line. For bringing it back in foreground use command "fg jobid" and for getting job id you use command "jobs", for killing that process find PID and use kill -9 PID command. This is indeed a good Unix Command interview questions because many of programmer not familiar with background process in UNIX.



December 27, 2019

Top 20 SQL Server Interview Questions and Answers



Ques: 1. What is SQL server agent?

Ans: 

The SQL Server agent plays a vital role in day to day tasks of SQL server administrator (DBA). Server agent's purpose is to implement the tasks easily with the scheduler engine which allows our jobs to run at scheduled date and time.


Oracle Fusion Applications interview Questions and Answers


Ques: 2. What is a Trigger?

Ans: 

Triggers are used to execute a batch of SQL code when insert or update or delete commands are executed against a table. Triggers are automatically triggered or executed when the data is modified. It can be executed automatically on insert, delete and update operations.


Oracle Accounts Payables Interview Questions and Answers

 

Ques: 3. What is the use of SET NOCOUNT ON/OFF statement?

Ans: 

By default, NOCOUNT is set to OFF and it returns number of records got affected whenever the command is getting executed. If the user doesn't want to display the number of records affected, it can be explicitly set to ON- (SET NOCOUNT ON).


Oracle ADF Interview Questions and Answers

 

Ques: 4. What is SQL injection?

Ans: 

SQL injection is an attack by malicious users in which malicious code can be inserted into strings that can be passed to an instance of SQL server for parsing and execution. All statements have to checked for vulnerabilities as it executes all syntactically valid queries that it receives.


Oracle Access Manager Interview Questions and Answers

 

Ques: 5. What will be the maximum number of index per table?

Ans: For SQL Server 2008 100 Index can be used as maximum number per table. 1 Clustered Index and 999 Non-clustered indexes per table can be used in SQL Server.

1000 Index can be used as maximum number per table. 

1 Clustered Index and 999 Non-clustered indexes per table can be used in SQL Server.


Oracle Fusion HCM Interview Questions and Answers


Ques: 6. What is Filtered Index?

Ans: 

Filtered Index is used to filter some portion of rows in a table to improve query performance, index maintenance and reduces index storage costs. When the index is created with WHERE clause, then it is called Filtered Index

 

Oracle SCM Interview Questions and Answers


Ques: 7. List the different index configurations possible for a table?

Ans: 

A table can have one of the following index configurations:

  • No indexes 
  • A clustered index 
  • A clustered index and many non-clustered indexes 
  • A non-clustered index 
  • Many non-clustered indexes


Oracle Financials Interview questions and Answers


Ques: 8. What is sub query and its properties?

Ans: 

A sub-query is a query which can be nested inside a main query like Select, Update, Insert or Delete statements. This can be used when expression is allowed. Properties of sub query can be defined as

  • A sub query should not have order by clause.
  • A sub query should be placed in the right hand side of the comparison operator of the main query. 
  • A sub query should be enclosed in parenthesis because it needs to be executed first before the main query. 
  • More than one sub query can be included.


Oracle Cloud Interview Questions and Answers


Ques: 9. What is Mirroring?

Ans: 

Mirroring is a high availability solution. It is designed to maintain a hot standby server which is consistent with the primary server in terms of a transaction. Transaction Log records are sent directly from the principal server to a secondary server which keeps a secondary server up to date with the principal server.

 

Oracle PL/SQL Interview Questions and Answers


Ques: 10. What is an execution plan?

Ans: 

An execution plan is a graphical or textual way of showing how the SQL server breaks down a query to get the required result. It helps a user to determine why queries are taking more time to execute and based on the investigation user can update their queries for the maximum result.

In Query Analyzer is an option called “Show Execution Plan” (located on the Query drop-down menu). If this option is turned on it will display a query execution plan in a separate window when a query is run again.

 

Oracle SQL Interview Questions and Answers


Ques: 11. What is a performance monitor?

Ans: 

Windows performance monitor is a tool to capture metrics for the entire server. We can use this tool for capturing events of the SQL server also.

Some useful counters are – Disks, Memory, Processors, Network, etc.

 

Oracle RDMS Interview Questions and Answers


Ques: 12. What is the difference between a Local and a Global temporary table?

Ans: 

If defined inside a compound statement a local temporary table exists only for the duration of that statement but a global temporary table exists permanently in the database but its rows disappear when the connection is closed.

 

BI Publisher Interview Questions and Answers


Ques: 13. What is the SQL Profiler?

Ans: 

SQL Profiler provides a graphical representation of events in an instance of SQL Server for monitoring and investment purpose. We can capture and save the data for further analysis. We can put filters as well to captures the specific data we want.

 

Oracle 10g Interview Questions and Answers


Ques: 14. What are the properties of the Relational tables?

Ans: 

Relational tables have six properties:

  1. Values are atomic. 
  2. Column values are of the same kind. 
  3. Each row is unique. 
  4. The sequence of columns is insignificant. 
  5. The sequence of rows is insignificant. 
  6. Each column must have a unique name.


BlockChain interview Questions and Answers


Ques: 15. What is View?

Ans: 

A view is a virtual table that contains data from one or more tables. Views restrict data access of the table by selecting only required values and make complex queries easy.

Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database

 

MySQL Interview Questions and Answers


Ques: 16. Why is replication required on the SQL Server?

Ans: 

Replication is the mechanism that is used to synchronize the data among the multiple servers with the help of a replica set.

This is mainly used to increase the capacity of the reading and to provide an option to its users to select among various servers to perform the read/write operations.

 

Azure Interview Questions and Answers


Ques: 17. What part does database design have to play in the performance of a SQL Server-based application?

Ans. 

It plays a very major part. When building a new system, or adding to an existing system, it is crucial that the design is correct. Ensuring that the correct data is captured and is placed in the appropriate tables, that the right relationships exist between the tables and that data redundancy is eliminated is an ultimate goal when considering performance. Planning a design should be an iterative process, and constantly reviewed as an application is developed. It is rare, although it should be the point that everyone tries to achieve, when the initial design and system goals are not altered, no matter how slightly. Therefore, a designer has to be on top of this and ensure that the design of the database remains efficient.

 

Ques: 18. What command is used to create a database in the SQL Server and how?

Ans: 

CREATEDATABASE Command is used to create any database in the SQL Server. Following is the way to use this command:

CREATEDATABASE Name of the Database

Example: If the name of a database is “employee” then create command to create this database that can be written as CREATEDATABASE employee.

 

Ques: 19. What is an extended stored procedure? Can you instantiate a COM object 

by using T-SQL?

Ans: 

An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement.

Yes, you can instantiate a COM (written in languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure. 

 

Ques: 20. When should SQL Server-based cursors be used, and not be used?

Ans: 

SQL Server cursors are perfect when you want to work one record at a time, rather than taking all the data from a table as a single bulk. However, they should be used with care as they can affect performance, especially when the volume of data increases. 

From a beginner’s viewpoint, I really do feel that cursors should be avoided every time because if they are badly written, or deal with too much data, they really will impact a system’s performance. There will be times when it is not possible to avoid cursors, and I doubt if many systems exist without them. If you do find you need to use them, try to reduce the number of records to process by using a temporary table first, and then building the cursor from this. The lower the number of records to process, the faster the cursor will finish. Always try to think “out of the envelope”.

 


More Interview Questions and Answers:

 

C language Interview Questions and Answers

 

C++ language Interview Questions and Answers

 

Machine Learning Interview Questions and Answers

  

PowerShell Interview Questions and Answers

 

Python Interview Questions and Answers

 

Python Pandas Interview Questions and Answers

 

SQL Server Interview Questions and Answers

 

Unix interview Questions and Answers

 

C# Language Interview Questions and Answers

 

CSS (Cascading Style Sheets ) Interview Questions and Answers

 

Robotic Process Automation(RPA) Interview Questions and Answers

 

UX Design Interview Questions and Answers

 

Docker Interview Questions and Answers

 

Google Cloud Computing Interview Questions and Answers

 

Linux Interview Questions and Answers

 

Data Science Interview Questions and Answers

 

Edge Computing Interview Questions and Answers

 

Hadoop Technical Interview Questions and Answers

 

Hyperion Technical Interview Questions and Answers

 

Internet of Things (IOT) Interview Questions and Answers

 

C# Language Interview Questions and Answers