0% found this document useful (0 votes)
14 views5 pages

Angular Interview Freebie

The document is a comprehensive guide for Angular interview preparation, covering various topics such as Typescript, RxJS, and Angular concepts. It includes specific coding questions and examples related to interfaces, observables, services, routing, and more. The guide aims to help candidates prepare for interviews by providing a structured list of potential questions and explanations of key concepts.

Uploaded by

gueye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Angular Interview Freebie

The document is a comprehensive guide for Angular interview preparation, covering various topics such as Typescript, RxJS, and Angular concepts. It includes specific coding questions and examples related to interfaces, observables, services, routing, and more. The guide aims to help candidates prepare for interviews by providing a structured list of potential questions and explanations of key concepts.

Uploaded by

gueye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Angular Interview Questions - Coding Interview

Section 1: Introduction
Section 2: Typescript
• How to create Typescript interface?
– Q1: Define a UserInterface with id: string, name: string, age: number
and method getMessage that returns string.
– Q2: Write a usage example of this interface
• How to define Typescript array?
– Q1: How to define an array in Typescript? Show all ways
– Q2: How to define an array of numbers and strings?
• What is type assertion in Typescript?
– Q1: What is type assertion?
– Q2: How to fix this code?
const getItem = (item: number | undefined) => {
return item.toString();
};
• What is void and unknown in Typescript?
– Q1: What is void type? Write an example
– Q2: What is unknown type? Write an example
• Create function annotation in Typescript
– Q1: Create a UserInterface with id: string, name: string, age: number
and method getMessage that returns string.
– Q2: Create ProfileInterface with name, profileUrl, isActive
– Q3: Create function which transforms UserInterface to ProfileInterface.
The profileUrl is /profile/${name}
– Q4: Add optional parameter isActive. Profile must be active if
parameter is not provided
• What is the purpose of tsconfig.json?
– Q1: What is tsconfig.json?
– Q2: What does this options do? target, module, moduleResolution,
noImplicitAny.
• What is elvis operator in Typescript?
– Q1: What is an elvis operator?
– Q2: Write a common use case of elvis operator.
• Why any is bad in Typescript?
– Q1: Why any type is bad?
• What are enums in Typescript?
– Q1: What is an enum?
– Q2: Write an enum example
– Q3: Why are they so good?
• How to create custom types in Typescript?
– Q1: How to create a custom type?
– Q2: When does it make sense?

1
• What are generics in Typescript?
– Q1: What are generics in Typescript?

Section 3: RxJS
• What are pros and cons of RxJS?
– Q1: What is RxJS?
– Q2: What are pros and cons of RxJS?
– Q3: Why RxJS is important for Angular?
• How to transform data in RxJS?
– Q1: You get such UserInterface. Define a function normalizeUsers
which gets a parameter users$ which is an observable of UserInterface
array and returns back an array of names as an observable.
interface UserInterface {
id: string;
name: string;
age: number;
}
– Q2: How RxJS map differs from Javascript map?
• How filter works in RxJS?
– Q1: Write an example of RxJS filter
– Q2: How it differs from Javascript filter?
• How to implement error handling in RxJS?
– Q1: Create an Observable and add error handling to it
– Q2: How will you write subscribe to be ready for an error?
• How does combineLatest operator work in RxJS?
– Q1: Do you know combineLatest method?
– Q2: Can you write an example?
• How Subject and BehaviorSubject work in RxJS?
– Q1: What is BehaviorSubject?
– Q2: What is the most common use case for BehaviorSubject in
Angular?
– Q3: How it differs from Subject?
• Observables vs Promises - what is the difference?
– Q1: What is the difference between observables and promises?
– Q2: What to use in Angular?
• Cold vs hot observables - what is the difference?
– Q1: What are cold and hot observables?
• ConcatMap vs SwitchMap vs MergeMap vs Map vs ExhaustMap in RxJS
– Q1: What is the difference between map, flatMap, mergeMap, con-
catMap, switchMap, exhaustMap

Section 3: Angular
• What is SPA?
– Q1: What is SPA?

2
– Q2: How it is difference to server side rendering?
– Q3: What are pros and cons of SPA?
• What are pros and cons of Angular compared to React?
– Q1: What are Angular pros and cons?
– Q2: How it is compared to React?
• How does Angular work?
– Q1: How does Angular work from files perspective? In what file it
starts loading, what files are loaded next?
• Sharing data between components in Angular
– Q1: How you can share your data between 2 different components?
• What ways of binding in Angular do you know?
– Q1: What ways of binding data exist in Angular?
– Q2: Write examples
• What is HTML in Angular?
– Q1: What is HTML in Angular?
• What are services in Angular?
– Q1: What are services in Angular?
– Q2: Write a DatesService with methods getTomorrow(), getYester-
day(), getToday()
• How to make HTTP Request in Angular?
– Q1: You have an interface User with id, name age. Create a
UsersService and getUsers method which makes a get request to
http://localhost:3004/users and returns a users stream
– Q2: Write the code to get this data in component
• How does dependency injection work?
– Q1: What is dependency injection in Angular?
– Q2: How does it work?
• How to use a router in Angular?
– Q1: How to add routing to the application?
– Q2: When global routing can be bad?
– Q3: What is router-outlet?
– Q4: How to create router link?
• What are life cycle hooks in Angular?
– Q1: What are life cycle hooks?
– Q2: When are they called?
• What are ViewChild and ViewChildren in Angular?
– Q1: Write an example of ViewChild
– Q2: Write an example of ViewChildren
• Constructor vs NgOnInit in Angular - what is the difference?
– Q1: What is the difference between constructor and ngOnInit?
– Q2: What should we use?
• Unsubscribe in Angular - why is it important?
– Q1: What is unsubscribe?
– Q2: Why is it important?
– Q3: What are the ways to unsubscribe?
• What are change detection and onPush in Angular?

3
– Q1: What is change detection?
– Q2: How does onPush work?
– Q3: Why onPush is important?
• Null in async pipe - what is the problem here?
– Q1: How to fix this error in the code? (see video)
• How to handle errors in async pipe in Angular
– Q1: How to handle errors in async pipe?
• What is the difference in ngContainer, ngTemplate, ngContent, ngTempla-
teOutlet?
– Q1: What is ng-container?
– Q2: What is ng-template?
– Q3: What is ng-content?
– Q4: What is ng-template-outlet?
• How to create an Angular animation?
– Q1: When to use Angular animations and not CSS animation?
– Q2: How to animate the following example?
<button (click)="fadeInOut()">Fade in / out</button>
<div *ngIf="isShown">This is a block with fade in / out</div>
• How as keyword works in Angular?
– Q1: What is as keyword?
– Q2: What does it do?
– Q3: Did you use it with combineLatest?
• AOT vs JIT compilation - what is the difference?
– Q1: What is AOT and JIT compilation?
– Q2: What is the difference?
• Component vs Directive - what is the difference?
– Q1: What is the difference between component and directive?
• Structural directive vs component directive vs attribute directive
– Q1: What is the difference between structural directives and compo-
nent directives?
• Create a directive which changes the background of the element
– Q1: Create a directive which changes the background of the element
• How do pipes in Angular work?
– Q1: What are pipes?
– Q2: What build in pipes do you know?
– Q3: Create a simple pipe
• Why is it bad to call a function in the Angular template?
– Q1: Why is it bad to call a function in template?
• What is Angular Ivy?
– Q1: What is Angular Ivy?
• What is Angular interceptor?
– Q1: Why do we need interceptors?
– Q2: Write an example of interceptor
• What is Angular generator?
– Q1: How to use generators?
• How to protect Angular route from accessing?

4
– Q1: What are Angular guards?
– Q2: Write an example of code to protect a route with both sync and
async ways
• What is lazy loading in Angular?
– Q1: How to load module on demand? (lazy loading)
– Q2: What are the benefits?
• What is forRoot in Angular?
– Q1: Write an example how to inject a module with some configuration
• What is SSR in Angular or Service Side Rendering?
– Q1: What is Angular SSR?
– Q2: What are pros and cons of SSR?
• What is ngZone in Angular?
– Q1: How to execute code outside Angular change detection?
– Q2: When does it make sense?
– Q3: Write a small example
• How do Angular forms work?
– Q1: What forms do we have in Angular?
– Q2: How do they differ?
• How to fix Angular input has no initializer error?
– Q1: How to fix this error (see video)
• NgRx - what is this and how does it work?
– Q1: Are you familiar with Redux or NgRx?
• Angular Inject
– Q1: How to use inject in Angular?
– Q2: What are the benefits?
• Angular standalone components
– Q1: How to use standalone components?
– Q2: What are the benefits?
• Angular signals
– Q1: How to use Angular Signals?
– Q2: What are the benefits?

Need help?
All these questions and knowledge might be overwhelming for you. But these
are real questions that you can get on the interview. Luckily, I covered all these
questions in my Angular Interview Questions course where I explain to you
answers to all these questions for different levels of knowledge.

You might also like