Q. What is the purpose of the `async` pipe in Angular templates?

  • (A) To make functions async
  • (B) To log async events
  • (C) To automatically subscribe and render async data
  • (D) To delay template loading
πŸ’¬ Discuss
βœ… Correct Answer: (C) To automatically subscribe and render async data
Explanation: The async pipe subscribes to Observables and updates the template.

Q. Which Angular tool is used to analyze and optimize bundle size?

  • (A) ng analyze
  • (B) ng audit
  • (C) ng build --stats-json
  • (D) ng watch
πŸ’¬ Discuss
βœ… Correct Answer: (C) ng build --stats-json
Explanation: `ng build --stats-json` generates stats for bundle analysis.

Q. What is the benefit of Angular's Ivy engine?

  • (A) Slower build time
  • (B) Larger bundle size
  • (C) Improved build performance and smaller bundles
  • (D) Increased complexity
πŸ’¬ Discuss
βœ… Correct Answer: (C) Improved build performance and smaller bundles
Explanation: Ivy improves performance, reduces bundle size, and supports better debugging.

Q. Which lifecycle hook is triggered after Angular projects external content into a component?

  • (A) ngOnInit
  • (B) ngAfterContentInit
  • (C) ngAfterViewInit
  • (D) ngDoCheck
πŸ’¬ Discuss
βœ… Correct Answer: (B) ngAfterContentInit
Explanation: ngAfterContentInit is called after content projection is done.

Q. How does Angular support internationalization (i18n)?

  • (A) Through ngTranslate
  • (B) By using i18n attribute and localization files
  • (C) Via pipe functions only
  • (D) Using ngLocale
πŸ’¬ Discuss
βœ… Correct Answer: (B) By using i18n attribute and localization files
Explanation: Angular provides i18n tools and attributes for localization support.

Q. Which command creates a new Angular workspace?

  • (A) ng generate workspace
  • (B) ng new
  • (C) ng build workspace
  • (D) ng create project
πŸ’¬ Discuss
βœ… Correct Answer: (B) ng new
Explanation: Use `ng new` to create a new Angular project/workspace.

Q. What is a directive in Angular?

  • (A) A class that adds behavior to elements
  • (B) A service
  • (C) A module
  • (D) An interceptor
πŸ’¬ Discuss
βœ… Correct Answer: (A) A class that adds behavior to elements
Explanation: Directives allow behavior to be added to DOM elements.

Q. Which part of Angular handles reactive forms?

  • (A) FormsModule
  • (B) ReactiveFormsModule
  • (C) TemplateModule
  • (D) FormGroupModule
πŸ’¬ Discuss
βœ… Correct Answer: (B) ReactiveFormsModule
Explanation: ReactiveFormsModule is used for reactive form development.

Q. What is the use of `RouterOutlet`?

  • (A) To display reactive forms
  • (B) To declare an Angular module
  • (C) To act as a placeholder for routed components
  • (D) To create child routes
πŸ’¬ Discuss
βœ… Correct Answer: (C) To act as a placeholder for routed components
Explanation: RouterOutlet is where routed components are displayed.

Q. What is an interceptor in Angular?

  • (A) A directive for routing
  • (B) A component used to delay loading
  • (C) A service that handles HTTP request/response globally
  • (D) A tool for unit testing
πŸ’¬ Discuss
βœ… Correct Answer: (C) A service that handles HTTP request/response globally
Explanation: Interceptors modify HTTP requests and responses globally.