Viva Questions
Viva Questions
Viva Questions
Question Bank
Module 1:
What is api?
Ans:
API stands for Application Programming Interface. It is a set of rules, protocols, and
tools that allows different software applications to communicate with each other.
In simpler terms, an API is a way for software applications to talk to each other and
exchange data. For example, when you use a weather app on your phone, the app
communicates with a weather API to retrieve up-to-date weather data for your
location.
2. Advantages of Node.js
Overall, the Node.js process model offers a modern, scalable approach to building
web applications that leverages the strengths of JavaScript and the efficiency of
asynchronous, event-driven programming.
5. Synchronous V/S Asynchronous programming
7. Applications of Node JS
Module 2
The basic idea behind the Event Emitter API is that an object, typically called an
"emitter", is capable of emitting events, and other objects can register themselves as
"listeners" for those events. When the emitter emits an event, all registered listeners
are notified, and their registered event handlers are executed.
The basic idea is that the callback function will be executed when the asynchronous
operation is complete, allowing the calling code to perform some action in response
to the result of that operation
Piping in Node.js works by connecting the output of one stream to the input of
another stream, creating a pipeline for the data to flow through. This is done using
the pipe() method, which is available on all readable and writable streams in Node.js.
Module 4:
We execute a simple SELECT query to fetch all rows from the customers table using
the connection.query() method. When the query completes, the results are returned to
the callback function, which logs the results to the console.
2. Command of SQL
SQL (Structured Query Language) is a programming language used to manage
and manipulate data in relational databases. Here are some of the most
common SQL commands:
SELECT, INSERT, UPDATE, DELETE, CREATE
Module 5:
1. What is Angular JS ?
1. Data binding: AngularJS provides two-way data binding, which means that
changes to the model are automatically reflected in the view, and vice versa.
2. Dependency injection: AngularJS uses a dependency injection system to
make it easier to manage and test complex applications.
3. Directives: AngularJS provides a set of built-in directives that can be used to
extend HTML with custom behavior and functionality.
4. Services: AngularJS provides a set of built-in services that can be used to
share data and functionality across different parts of an application.
5. Routing: AngularJS provides a built-in routing system that can be used to
create single-page applications with multiple views
1. Model: The model represents the data and business logic of the application. It
manages the data, validates user input, and responds to requests from the
controller.
2. View: The view represents the user interface of the application. It displays the
data from the model and receives user input, which is then passed on to the
controller.
3. Controller: The controller acts as an intermediary between the model and the
view. It receives user input from the view, interacts with the model to retrieve
or modify data, and updates the view with the new data.
1. ng-app: Defines the root element of the AngularJS application and initializes
the framework.
2. ng-model: Binds an input, select, or textarea element to a property on the
scope, enabling two-way data binding.
3. ng-repeat: Loops over a collection and generates HTML elements for each
item in the collection.
4. ng-click: Binds a function to a click event on an element.
5. ng-if: Conditionally displays an element based on an expression.
String expressions are enclosed in double curly braces "{{ }}" and can contain
AngularJS expressions, variables, functions, and operators. For example, to display
the value of a string variable named "name" in an HTML template,
Number expressions are similar to string expressions, but are used to display
dynamic numeric values. They can also include operators, functions, and
variables, and are enclosed in double curly braces "{{ }}" like string expressions.
For example, to display the sum of two numeric values in an HTML template,
Module 6:
To use a filter in AngularJS, you simply add the filter name to an expression
using the pipe "|" symbol, followed by any parameters that the filter requires.
For example, to use the built-in "uppercase" filter to convert a string to
uppercase,
Date, currency, limitTo, orderBy, lowercase/uppercase
2. Conditional Directives
Conditional directives are a type of directive in AngularJS that allow
developers to conditionally show or hide elements in the UI based on a
certain condition. These directives are useful for building dynamic,
data-driven web applications, where certain elements may need to be
displayed or hidden based on user input or other factors.
ng-if: This directive conditionally shows or hides an element based on a
boolean expression. If the expression evaluates to true, the element is shown.
ng-show/ng-hide: These directives conditionally show or hide an element
based on a boolean expression. If the expression evaluates to true, the
element is shown using the "ng-show" directive.
ng-switch: This directive conditionally shows one element from a set of
elements, based on a given value. Each element is associated with a specific
value, and the element corresponding to the current value is shown, while the
others are hidden
3. Styles Directives
In AngularJS, directives are used to extend the HTML syntax with new behavior and
functionality. One type of directive is the "style" directive, which is used to
manipulate the styling of HTML elements in the view.
The ng-style directive is used to dynamically set the style of an HTML element based
on an expression in the controller's $scope object.
he ng-class directive is used to dynamically set the CSS class of an HTML element
based on an expression in the controller's $scope object.
1. ng-app directive:
The ng-app directive is used to define the root element of an AngularJS application. This
directive initializes the AngularJS application and tells AngularJS which part of the HTML
2. ng-init directive:
The ng-init directive is used to initialize values in the controller's $scope object. This directive
evaluates an expression and assigns the result to a variable in the $scope object.
3. ng-model directive:
The ng-model directive is used to bind an HTML element (such as an input field) to a property
in the controller's $scope object. This directive creates a two-way binding between the HTML
element and the $scope object, so changes to the HTML element are automatically reflected
There are many other built-in directives in AngularJS, such as ng-repeat, ng-click, ng-show,
ng-hide, and many more. These directives are used to add functionality and behavior to
HTML elements in the view and are an essential part of building dynamic and interactive
The $scope object is used to share data between the controller and the view. Data
can be defined on the $scope object in the controller, and then accessed and
displayed in the view using expressions or directives.
The $scope object also provides a mechanism for detecting changes in the data and
updating the view accordingly. AngularJS uses a process called "digest cycle" to
monitor the $scope object and update the view when changes are detected.
Module 8:
SPA stands for Single-Page Application, which is a type of web application that loads
and interacts with a single web page. The content of the page is dynamically updated
as the user interacts with the application, without requiring a full page reload. The
primary benefit of SPAs is that they provide a faster and more responsive user
experience, as well as improved performance since the server only needs to send
data rather than full pages.
SPAs can be used to create fast, responsive web applications that provide a seamless
user experience. Applications, on the other hand, can be used to perform a wide range
of tasks and functions, depending on their specific purpose and design
2. Advantages of SPA.
1. Fast and responsive user experience: SPAs can provide a faster and more
responsive user experience since the server only needs to send data rather
than full pages. This means that the page content can be updated
dynamically without requiring a full page reload, which can significantly
improve the user experience.
2. Better scalability: SPAs can be more scalable compared to multi-page
applications since they can handle a larger volume of users with fewer server
resources. This is because the server only needs to send data and handle
requests, rather than generating and rendering full pages
3. Validation in Angular JS
In AngularJS, validation can be achieved using the built-in ng-model directive and the
ng-valid, ng-invalid, and ng-dirty classes.
1.Add the ng-model directive to your form elements. This directive binds the value of
the form element to a variable in the controller
2.Use the ng-show directive to show error messages when the field is invalid.
1. Create a new directive using the directive method of your AngularJS module:
2. we create a directive named customValidation, which requires the ngModel
controller. The link function is called when the directive is linked to an element.
We define a new validator named customValidation that takes the input value as
its argument and returns true or false based on the validation result.
3. we apply the custom-validation directive to an input element. The ng-model
directive is used to bind the input value to a variable in the scope.