Loading, please wait...

A to Z Full Forms and Acronyms

Frequently asked : Angular Interview Questions with Answers

Angular 2+ Interview Question with Answer

In this article, we will see the Angular interview question with an answer. It is for everyone who has experience or not.

Angular Interview Questions with Answers,

Q1. Question: What is Angular?

Answer: Angular is a TypeScript-based open-source web application framework,
developed and maintained by Google. It offers an easy and powerful way of building front end web-based applications.

Angular integrates a range of features like declarative templates, dependency injection, end-to-end tooling, etc. that facilitates web application development.

Q2. What is Typescript?

Answer:  Typescript is a Superset of JavaScript meaning any JavaScript code is valid typescript code.
Typescript is Trans piled to JavaScript behind the scene in the IDE.
Typescript allows us to use generic programming (classes and modules). Typescript follows the ECMAScript 2015 standard which contains features like:

A.  Generic
B.  Namespaces
C. Enumerated type
D. Interfaces


Q3. What is NPM and why do we need it?

Answer:  Npm stands for the Node package manager. It is an online repository and works as a package manager for JavaScript.
A package.json file in our application defines the dependencies that we want to download for our application.


Q4. Explain Components in Angular 2?

Answer: In angular, a Component is a special type of directive in angular 2+ that uses a simpler configuration,
which is suitable for a component-based application structure. It should only one or more than one in an application.
It is consists of three things, they are as given below.
A. Class − This is like a C or Java class which consists of properties and methods.
B. Template − This is used to define the HTML view which is displayed in the application.
C. Metadata − This is used to decorate the class and extend the functionality of the class.

Q5. How many types of directive and explain it?

Answer:
There are three types of directive.
A. Component Directive
B. Structural Directive
C. Attributes Directive

Let's start one by one.

1. Component Directive: It is also a type of directive with template, style and logic part which
is a very famous directive. We can't create any angular application without it.
It is at least one in an angular application.

2. Structural Directive:
Answer: It is responsible for the HTML layout. It changes the shape or reshapes the HTML view by simple adding
or removing the element in the DOM. Structural directives are given below.
A. NgIf (*ngIf)
B. NgFor (*ngFor)
C. NgSwitch (ngSwitch)


3. Attributes Directive: It is a way to modify the appearance of the DOM element or component.

Answer:
There are two types of build in the directive.
A. NgStyle: Angular provides a built-in NgStyle attribute to modify the element appearance.
B. NgClass: This attribute is used to change the class attribute of the element in DOM or component which it has attached.

Q6. What are directives in Angular?

Answer:
A core feature of Angular, directives are attributes that allow you to write new HTML syntax, specific to your application.
They are essentially functions that execute when the Angular compiler finds them in the DOM. The Angular directives are segregated into 3 parts:

  1. Component Directives
  2. Structural Directives
  3. C.Attribute Directives

Q7. Name the building blocks of Angular.

Answer:
The Angular application is made using the following:
A. Modules
B. Component
C. Template
D. Directives
E. Data Binding
F. Services
G. Dependency Injection
H. Routing

Q8. Can you tell me those browsers which are supported by angular 2+?

Answer:
A. Google Chrome
B. Firefox
C. Edge
D. IE for versions 9-11
E. Safari
F. iOS 7.1
G. Android 4.1
H. IE Mobile

Q9. What is AOT?

Answer:
AOT stands for Ahead of Time. It is the compilation in which Angular compiles the components and templates to JavaScript and HTML while developing

Q10. What is Event Emitters?

Answer:
It is a special type of class defined in a core module that can be used by components and directives to emit custom events.

Q11. What is an event & it's type in Angular?

Answer:
Events in Angular are specific directives that help in customizing the behavior of various DOM events. Some events are given below.

A. ng-click
B. ng-copy
C. ng-cut
D. ng-dblclick
E. ng-keydown
F. ng-keypress
G. ng-keyup
H. ng-mousedown
I. ng-mouseenter
J. ng-mouseleave
K. ng-mousemove
L. ng-mouseover
M. ng-mouseup
N. ng-blur

Q12. Tell me some testing tools for angular application?

Answer:

  1. Karma
  2. Angular Mocks
  3. Mocha
  4. Browserify
  5. Sion

Q13. Question: What is Transpiling in Angular?

Answer: Transpiling means converting the source code from one programming language into another programming language.
It means it over the TypeScript into JavaScript.

Q14. Is angular 2 Object-Oriented?

Answer: Yes, Angular 2 is a true object-oriented development framework.

Q15. What is CLI?

Answer:  CLI is the acronym of Command Line Interface, which can be used to create the Angular JS or angular application.Using CLI.

Q16. What is the directive?

Answer: Directive are the elements that change the appearance or behavior of the DOM
element.

Q17. What is a module?

Answer: Modules are logical boundaries in your application and the application is divided into separate modules to separate the functionality of your application.

Q18. In Angular, how can you interact between Parent and Child components?

Answer: When passing data from Parent to Child component, you can use the @Input decorator in
the Child component. When passing data from Child to Parent component, you can use the @Output
decorator in the Child component.

Q19. Does Angular support nested controllers?

Answer: Yes, Angular does support the concept of nested controllers. And it needs to be defined in a hierarchical manner for using it, in the View. 

Q20. What are Angular expressions?

Answer: It is a very special type of expression that placed/binding the values such as {{ expression }} similar to JavaScript.
It is used to bind application data into HTML.

Syntax: {{ expression }}

I hope it will for all of you.

A to Z Full Forms and Acronyms

Related Article