Learn Quiz

Angular Quiz

Test your Angular knowledge. — 8 questions

Question 1 of 8 Score: 0

About the Angular Quiz

Test your Angular knowledge. This quiz has 8 multiple-choice questions. Each question has one correct answer, and you see an explanation straight after you answer, so you learn from every question — including the ones you get wrong. There is no time limit and nothing to sign up for; your answers are not stored.

The questions follow the material in the Angular Fundamentals guide and the Angular cheatsheet. Read them first if you want to prepare, or take the quiz cold to find the gaps in what you know.

Questions in this quiz

Preview the questions below. Each answer and its explanation are hidden until you choose to reveal them, so you can still take the quiz above without spoilers.

1. Which decorator marks a TypeScript class as an Angular component?

  1. @Injectable
  2. @NgModule
  3. @Component
  4. @Directive
Show answer

Answer: C. @Component
@Component configures the selector, template, and styles. @Injectable is for services, @NgModule for modules.

2. What is the syntax for two-way data binding in Angular?

  1. [value]
  2. (value)
  3. [(ngModel)]
  4. {{value}}
Show answer

Answer: C. [(ngModel)]
[(ngModel)] combines [] property binding and () event binding — nicknamed "banana in a box". Requires FormsModule.

3. Which directive conditionally adds or removes an element from the DOM?

  1. *ngFor
  2. *ngIf
  3. [ngClass]
  4. [ngStyle]
Show answer

Answer: B. *ngIf
*ngIf removes the element entirely when false. [ngClass] only toggles CSS classes without removing the element.

4. What is the purpose of a Service in Angular?

  1. Define the component template
  2. Handle routing
  3. Share reusable logic and data between components
  4. Apply CSS styles globally
Show answer

Answer: C. Share reusable logic and data between components
Services hold business logic and shared data. They are injected via DI rather than instantiated directly.

5. How is a service injected into a component?

  1. document.inject()
  2. Importing and calling new manually
  3. Through the constructor via Dependency Injection
  4. Using the @Inject property decorator on a field
Show answer

Answer: C. Through the constructor via Dependency Injection
Angular reads constructor parameter types and provides the registered singleton automatically.

6. What does *ngFor do?

  1. Conditionally renders one element
  2. Iterates a collection, rendering a template for each item
  3. Applies CSS classes dynamically
  4. Binds a form control to a model
Show answer

Answer: B. Iterates a collection, rendering a template for each item
*ngFor="let item of items" renders the host element once per item, creating a local template variable.

7. What is an Angular pipe used for?

  1. Component communication
  2. Making HTTP requests
  3. Transforming displayed values in templates
  4. Navigating between routes
Show answer

Answer: C. Transforming displayed values in templates
Pipes transform values inline: {{ date | date:"short" }}, {{ amount | currency }}. Custom pipes use @Pipe.

8. What does the @Input() decorator do?

  1. Marks a method as a lifecycle hook
  2. Allows the property to be set by a parent component
  3. Injects a service into the class
  4. Emits an event to the parent
Show answer

Answer: B. Allows the property to be set by a parent component
@Input() exposes a property so parent components can pass data down: <child [title]="myTitle">.

How to use this quiz

  • Answer every question before reading the explanations below — retrieving an answer from memory is what makes it stick.
  • Note the questions you missed and revisit the matching section of the guide or cheatsheet.
  • Retake the quiz a day or two later. Spaced repetition is one of the most reliable ways to remember technical details.

Related