Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 26–50 of 84

Career & HR topics

By tech stack

Junior PDF
What is TestBed in Angular, and how is it used?

Answer: TestBed is the primary API to configure and initialize the environment for unit testing Angular components and services. It allows you to declare components, provide services, import modules, and compile template…

Angular Read answer
Mid PDF
How do you add third-party libraries using Angular CLI?

Use npm or yarn to install the package: npm install lodash If the library requires it, add typings: npm install --save-dev @types/lodash Some libraries have Angular-specific schematics that you can add via: ng add @angul…

Angular Read answer
Mid PDF
How do you import and export modules in Angular?

To use a module’s components/directives/pipes, import it in your module’s imports array. To make components/directives/pipes available to other modules, export them in your module’s exports array. Example: @NgModule({ im…

Angular Read answer
Mid PDF
How do you optimize performance in Angular

pplications? Common techniques: Use OnPush change detection. Implement trackBy in *ngFor. Use lazy loading for modules. Avoid heavy computations in templates. Use pure pipes for filtering/formatting. Use memoization to c…

Angular Read answer
Mid PDF
Bind the form in template using formGroup and formControlName.?

✅ Example: this.profileForm = new FormGroup({ firstName: new FormControl('', Validators.required), lastName: new FormControl(''), email: new FormControl('', [Validators.required, Validators.email]) }); <form [formGrou…

Angular Read answer
Mid PDF
How do you handle validation in template-driven forms?

Use built-in validators via HTML attributes like required, minlength. Use Angular directives like #username="ngModel" to check validity. ✅ Example: <input name="email" ngModel required email #email="ngModel" /> &lt…

Angular Read answer
Mid PDF
Add <router-outlet></router-outlet> in the template. ✅ Example: // app-routing.module.ts const routes: Routes = [ { path: 'home', component: HomeComponent }, { path: 'about', component: AboutComponent } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule {} The RouterModule is a built-in Angular module that provides routing directives, services,

nd configuration to manage navigation between views. ✅ Imports in App: import { RouterModule } from '@angular/router'; You use it with RouterModule.forRoot() (for root module) or RouterModule.forChild() (for feature modu…

Angular Read answer
Mid PDF
Attribute Directives – Change appearance/behavior (e.g., ngClass, ngStyle)?

Examples: &lt;!-- *ngIf --&gt; &lt;div *ngIf="user.isLoggedIn"&gt;Welcome, {{ user.name }}&lt;/div&gt; &lt;!-- *ngFor --&gt; &lt;li *ngFor="let item of items"&gt;{{ item }}&lt;/li&gt; Real-Time Example: In a to-do app, *…

Angular Read answer
Mid PDF
What are directives in Angular? Can you give examples?

Answer: Directives are instructions in the DOM. They help Angular extend HTML's capabilities. Types of Directives: What interviewers expect A clear definition tied to Angular in Angular projects Trade-offs (performance,…

Angular Read answer
Junior PDF
What is the importance of lazy loading modules in large Angular applications?

Lazy loading loads feature modules only when needed (e.g., when a user navigates to a route). Benefits: Reduces initial bundle size → faster app startup. Improves performance and user experience. Enables better code spli…

Angular Read answer
Mid PDF
What are Angular’s security features for protecting

gainst XSS and CSRF? XSS (Cross-Site Scripting) Protection: Angular automatically sanitizes dangerous content in templates (e.g., {{ userInput }}). Use DomSanitizer for trusted content. Binding syntax prevents direct HTM…

Angular Read answer
Junior PDF
What is JWT (JSON Web Token), and how is it used in Angular?

JWT is a compact, URL-safe token format that securely transmits information between parties. Contains a payload with user info and claims, digitally signed. Angular apps use JWT to: Store authentication state. Send it wi…

Angular Read answer
Mid PDF
How do you mock services in Angular tests? ● Provide a mock implementation of the service in TestBed using the providers

rray. Use useClass, useValue, or useFactory to inject mocks. Example: class MockDataService { getData() { return of(['mock data']); } } beforeEach(() =&gt; { TestBed.configureTestingModule({ providers: [{ provide: DataSe…

Angular Read answer
Junior PDF
What is the difference between ng build and ng serve?

Answer: Comman Purpose ng serve Builds app in memory, runs a dev server, watches files, reloads on changes (for development) ng build Builds app to disk, generates production or development-ready output files What interv…

Angular Read answer
Junior PDF
What is CommonModule in Angular, and when do you need to import it?

Answer: CommonModule provides common directives like *ngIf, *ngFor, ngClass, etc. You import it in feature modules or any module other than the root module. Don’t import BrowserModule in feature modules; instead, import…

Angular Read answer
Junior PDF
What is trackBy in ngFor, and how does it improve performance? trackBy is a function used with *ngFor to tell Angular how to track list items uniquely. Why it matters: Without trackBy, Angular recreates DOM elements on each update, causing performance overhead. ✅ Example: <div *ngFor="let item of items; trackBy: trackById"> {{ item.name }} </div> trackById(index: number, item: any) { return item.id; // unique id per item }

ngular reuses existing DOM elements instead of recreating them. What interviewers expect A clear definition tied to Angular in Angular projects Trade-offs (performance, maintainability, security, cost) When you would and…

Angular Read answer
Junior PDF
What is the role of FormControl, FormGroup, and FormArray in reactive forms?

Answer: Class Role FormContr ol Tracks value and validation status of a single input FormGroup Groups multiple FormControls into a form FormArray Manages an array of FormControls or FormGroups dynamically What interviewe…

Angular Read answer
Junior PDF
What is the difference between ngOnInit and constructor in Angular?

spect Constructor ngOnInit Purpose Initializes the class Lifecycle hook, called after constructor Use Case Inject dependencies Fetch data, initialize logic Called By JavaScript engine Angular Example: constructor(private…

Angular Read answer
Mid PDF
How do you optimize Angular applications for faster load times? ● Use Ahead-of-Time (AOT) compilation for faster rendering. ● Enable production builds (ng build --prod) with optimizations: ○ Minification ○ Tree shaking ○ Dead code elimination ● Use lazy loading for feature modules. ● Bundle analysis: Use tools like source-map-explorer to find large bundles. ● Use Angular’s built-in caching and service workers (via Angular PWA) for offline

nd faster repeat loads. Optimize images and assets (compress, lazy load). Use OnPush change detection for components to reduce unnecessary UI updates. Avoid memory leaks by unsubscribing from observables. Use trackBy fun…

Angular Read answer
Junior PDF
What is a CustomEvent in Angular, and how is it used?

CustomEvent is a native JavaScript event that allows sending custom data. In Angular, used in event emitters to pass data from child to parent components. Angular wraps this with @Output() and EventEmitter. Example: @Out…

Angular Read answer
Mid PDF
How do you manage state in Angular with NgRx?

NgRx is a Redux-inspired state management library for Angular. Uses Actions, Reducers, Store, and Effects to handle application state predictably. Centralizes state for easy debugging, time-travel, and immutability. Idea…

Angular Read answer
Junior PDF
What is the difference between ngMocks and TestBed?

Answer: TestBed: Core Angular testing utility to configure test modules and components. ngMocks: A library built on top of TestBed to simplify mocking and reduce boilerplate by auto-mocking components, directives, pipes,…

Angular Read answer
Mid PDF
How do you optimize Angular application builds for production?

Use the production flag with ng build: ng build --prod This enables: AOT compilation (Ahead-of-Time) Minification and Uglification of code Tree shaking to remove unused code Bundling for fewer HTTP requests Enables optim…

Angular Read answer
Junior PDF
What is the purpose of BrowserModule in Angular?

Answer: BrowserModule includes services essential for running the app in a browser. It also exports CommonModule. Should only be imported once, in the root AppModule. It sets up things like DOM rendering, sanitization, a…

Angular Read answer
Mid PDF
How do you use ChangeDetectorRef in Angular?

ChangeDetectorRef allows you to manually control change detection: detectChanges(): Run change detection immediately. markForCheck(): Mark component to check in next cycle. detach(): Stop change detection for component.…

Angular Read answer

Angular Angular Tutorial · Angular

Answer: TestBed is the primary API to configure and initialize the environment for unit testing Angular components and services. It allows you to declare components, provide services, import modules, and compile templates.

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

  • Use npm or yarn to install the package:

npm install lodash

  • If the library requires it, add typings:

npm install --save-dev @types/lodash

  • Some libraries have Angular-specific schematics that you can add via:

ng add @angular/material

This command installs and configures Angular Material automatically.

Permalink & share

Angular Angular Tutorial · Angular

  • To use a module’s components/directives/pipes, import it in your module’s

imports array.

  • To make components/directives/pipes available to other modules, export them in

your module’s exports array.

Example:

@NgModule({

imports: [CommonModule],

exports: [MyComponent, MyDirective]

})

export class SharedModule {}

Then import SharedModule in any module where you want to use those components.

Permalink & share

Angular Angular Tutorial · Angular

pplications?

Common techniques:

  • Use OnPush change detection.
  • Implement trackBy in *ngFor.
  • Use lazy loading for modules.
  • Avoid heavy computations in templates.
  • Use pure pipes for filtering/formatting.
  • Use memoization to cache expensive function results.
  • Detach change detector manually for rarely updated components.
  • Use ngZone.runOutsideAngular() for non-Angular async operations.
Permalink & share

Angular Angular Tutorial · Angular

✅ Example:

this.profileForm = new FormGroup({

firstName: new FormControl('', Validators.required),

lastName: new FormControl(''),

email: new FormControl('', [Validators.required,

Validators.email])

});

<form [formGroup]="profileForm" (ngSubmit)="onSubmit()">

<input formControlName="firstName" />

<input formControlName="lastName" />

<input formControlName="email" />

<button type="submit">Submit</button>

</form>

Permalink & share

Angular Angular Tutorial · Angular

  • Use built-in validators via HTML attributes like required, minlength.
  • Use Angular directives like #username="ngModel" to check validity.

✅ Example:

<input name="email" ngModel required email #email="ngModel" />

<div *ngIf="email.invalid && email.touched">

<small *ngIf="email.errors?.required">Email is required</small>

<small *ngIf="email.errors?.email">Invalid email format</small>

</div>

Permalink & share

Angular Angular Tutorial · Angular

nd configuration to manage navigation between views.

✅ Imports in App:

import { RouterModule } from '@angular/router';

You use it with RouterModule.forRoot() (for root module) or

RouterModule.forChild() (for feature modules with lazy loading).

ngular?

Routes are defined as an array of objects using the Routes type, and each route object

maps a path to a component.

✅ Example:

const routes: Routes = [

{ path: '', component: HomeComponent },

{ path: 'products', component: ProductListComponent },

{ path: 'products/:id', component: ProductDetailComponent },

{ path: '**', component: NotFoundComponent } // wildcard route

];

Tools for Managing Routes:

  • Route Guards
  • Route Parameters
  • Lazy Loading
  • Query Params
  • Nested Routes

implemented?

🔸 Lazy Loading:

Lazy loading is a technique to load feature modules only when needed, improving initial

load performance.

✅ Implementation:

Permalink & share

Angular Angular Tutorial · Angular

Examples:

<!-- *ngIf -->

<div *ngIf="user.isLoggedIn">Welcome, {{ user.name }}</div>

<!-- *ngFor -->

<li *ngFor="let item of items">{{ item }}</li>

Real-Time Example:

In a to-do app, *ngFor is used to loop through tasks and display them.

Permalink & share

Angular Angular Tutorial · Angular

Answer: Directives are instructions in the DOM. They help Angular extend HTML's capabilities. Types of Directives:

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

  • Lazy loading loads feature modules only when needed (e.g., when a user navigates

to a route).

  • Benefits:
  • Reduces initial bundle size → faster app startup.
  • Improves performance and user experience.
  • Enables better code splitting and modularity.
  • Angular supports lazy loading via dynamic route configuration:

{ path: 'products', loadChildren: () =>

import('./products/products.module').then(m => m.ProductsModule) }

Permalink & share

Angular Angular Tutorial · Angular

gainst XSS and CSRF?

  • XSS (Cross-Site Scripting) Protection:
  • Angular automatically sanitizes dangerous content in templates (e.g., {{

userInput }}).

  • Use DomSanitizer for trusted content.
  • Binding syntax prevents direct HTML injection.
  • CSRF (Cross-Site Request Forgery) Protection:
  • Angular’s HttpClient works with backend CSRF tokens.
  • Common approach: Backend sends CSRF token, Angular sends it back via

headers or cookies.

  • Developers must implement token handling in interceptors.
Permalink & share

Angular Angular Tutorial · Angular

  • JWT is a compact, URL-safe token format that securely transmits information

between parties.

  • Contains a payload with user info and claims, digitally signed.
  • Angular apps use JWT to:
  • Store authentication state.
  • Send it with API requests to authorize access.
  • Decode JWT to get user roles, expiry, etc.
Permalink & share

Angular Angular Tutorial · Angular

rray.

  • Use useClass, useValue, or useFactory to inject mocks.

Example:

class MockDataService {

getData() { return of(['mock data']); }

}

beforeEach(() => {

TestBed.configureTestingModule({

providers: [{ provide: DataService, useClass: MockDataService }]

});

});

Permalink & share

Angular Angular Tutorial · Angular

Answer: Comman Purpose ng serve Builds app in memory, runs a dev server, watches files, reloads on changes (for development) ng build Builds app to disk, generates production or development-ready output files

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

Answer: CommonModule provides common directives like *ngIf, *ngFor, ngClass, etc. You import it in feature modules or any module other than the root module. Don’t import BrowserModule in feature modules; instead, import CommonModule there.

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

ngular reuses existing DOM elements instead of recreating them.

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

Answer: Class Role FormContr ol Tracks value and validation status of a single input FormGroup Groups multiple FormControls into a form FormArray Manages an array of FormControls or FormGroups dynamically

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

spect Constructor ngOnInit

Purpose Initializes the class Lifecycle hook, called after constructor

Use Case Inject

dependencies

Fetch data, initialize logic

Called By JavaScript engine Angular

Example:

constructor(private userService: UserService) {}

ngOnInit() {

this.userService.getUsers().subscribe(users => this.users =

users);

}

Real-Time Example:

In a profile component:

  • Use constructor to inject ProfileService
  • Use ngOnInit to fetch the user's data after initialization
Permalink & share

Angular Angular Tutorial · Angular

nd faster repeat loads.

  • Optimize images and assets (compress, lazy load).
  • Use OnPush change detection for components to reduce unnecessary UI updates.
  • Avoid memory leaks by unsubscribing from observables.
  • Use trackBy function with *ngFor to optimize DOM updates.
Permalink & share

Angular Angular Tutorial · Angular

  • CustomEvent is a native JavaScript event that allows sending custom data.
  • In Angular, used in event emitters to pass data from child to parent components.
  • Angular wraps this with @Output() and EventEmitter.

Example:

@Output() myEvent = new EventEmitter<string>();

this.myEvent.emit('some data');

Permalink & share

Angular Angular Tutorial · Angular

  • NgRx is a Redux-inspired state management library for Angular.
  • Uses Actions, Reducers, Store, and Effects to handle application state predictably.
  • Centralizes state for easy debugging, time-travel, and immutability.
  • Ideal for complex apps requiring consistent global state management.
Permalink & share

Angular Angular Tutorial · Angular

Answer: TestBed: Core Angular testing utility to configure test modules and components. ngMocks: A library built on top of TestBed to simplify mocking and reduce boilerplate by auto-mocking components, directives, pipes, and services.

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

  • Use the production flag with ng build:

ng build --prod

  • This enables:
  • AOT compilation (Ahead-of-Time)
  • Minification and Uglification of code
  • Tree shaking to remove unused code
  • Bundling for fewer HTTP requests
  • Enables optimizations in angular.json
Permalink & share

Angular Angular Tutorial · Angular

Answer: BrowserModule includes services essential for running the app in a browser. It also exports CommonModule. Should only be imported once, in the root AppModule. It sets up things like DOM rendering, sanitization, and event handling.

What interviewers expect

  • A clear definition tied to Angular in Angular projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Angular application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Angular architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Angular Angular Tutorial · Angular

ChangeDetectorRef allows you to manually control change detection:

  • detectChanges(): Run change detection immediately.
  • markForCheck(): Mark component to check in next cycle.
  • detach(): Stop change detection for component.
  • reattach(): Resume change detection.

✅ Example:

constructor(private cd: ChangeDetectorRef) {}

updateData() {

this.data = fetchNewData();

this.cd.detectChanges(); // manually trigger update

}
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details