Q. What does the inject() function replace?

  • (A) NgModule
  • (B) Constructor-based dependency injection
  • (C) Services
  • (D) Providers
πŸ’¬ Discuss
βœ… Correct Answer: (B) Constructor-based dependency injection
Explanation: inject() allows DI without constructors.

Q. Which Angular feature enables hydration in SSR?

  • (A) Zone.js
  • (B) TransferState
  • (C) NgModule
  • (D) HttpClient
πŸ’¬ Discuss
βœ… Correct Answer: (B) TransferState
Explanation: TransferState helps transfer data from server to client.

Q. What does the router-outlet directive do?

  • (A) Loads services
  • (B) Acts as placeholder for routed views
  • (C) Handles guards
  • (D) Preloads modules
πŸ’¬ Discuss
βœ… Correct Answer: (B) Acts as placeholder for routed views
Explanation: router-outlet displays routed components.

Q. Which lifecycle hook is called when an input property changes?

  • (A) ngOnInit
  • (B) ngDoCheck
  • (C) ngOnChanges
  • (D) ngAfterViewInit
πŸ’¬ Discuss
βœ… Correct Answer: (C) ngOnChanges
Explanation: ngOnChanges reacts to @Input() changes.

Q. Which operator is used to handle errors in RxJS?

  • (A) catchError
  • (B) throwError
  • (C) retry
  • (D) finalize
πŸ’¬ Discuss
βœ… Correct Answer: (A) catchError
Explanation: catchError handles observable errors.

Q. Which Angular feature supports tree shaking?

  • (A) NgModules
  • (B) providedIn
  • (C) Two-way binding
  • (D) Event emitters
πŸ’¬ Discuss
βœ… Correct Answer: (B) providedIn
Explanation: providedIn enables tree-shakable providers.

Q. Which API is used to dynamically create components?

  • (A) ComponentFactoryResolver
  • (B) Renderer2
  • (C) ViewEncapsulation
  • (D) TemplateRef
πŸ’¬ Discuss
βœ… Correct Answer: (A) ComponentFactoryResolver
Explanation: ComponentFactoryResolver dynamically creates components.