Q. What does Angular use for dependency injection?

  • (A) Injector class
  • (B) Service class
  • (C) DI container
  • (D) Zone.js
πŸ’¬ Discuss
βœ… Correct Answer: (A) Injector class
Explanation: Angular uses the Injector class to inject dependencies.

Q. Which decorator is used to emit events to parent components?

  • (A) @Input
  • (B) @Output
  • (C) @Injectable
  • (D) @NgModule
πŸ’¬ Discuss
βœ… Correct Answer: (B) @Output
Explanation: @Output is used to emit custom events to parent components.

Q. What symbol is used to denote event binding?

  • (A) []
  • (B) ()
  • (C) [()]
  • (D) {}
πŸ’¬ Discuss
βœ… Correct Answer: (B) ()
Explanation: Parentheses () are used for event binding in Angular.

Q. Which concept ensures code modularity in Angular?

  • (A) Components
  • (B) Modules
  • (C) Directives
  • (D) Pipes
πŸ’¬ Discuss
βœ… Correct Answer: (B) Modules
Explanation: Modules group related code and ensure modular architecture.

Q. How is the root component of Angular app identified?

  • (A) It uses @NgModule
  • (B) It is declared in main.ts
  • (C) It is listed in bootstrap array in AppModule
  • (D) It is named root.component.ts
πŸ’¬ Discuss
βœ… Correct Answer: (C) It is listed in bootstrap array in AppModule
Explanation: The root component is listed in the bootstrap array of AppModule.

Q. What does `ngOnChanges` do?

  • (A) Executes when the app starts
  • (B) Executes when input properties change
  • (C) Executes when the view is initialized
  • (D) Executes when the component is destroyed
πŸ’¬ Discuss
βœ… Correct Answer: (B) Executes when input properties change
Explanation: ngOnChanges is triggered when input property values change.

Q. What is Zone.js used for in Angular?

  • (A) Routing
  • (B) HTTP Requests
  • (C) Change detection
  • (D) State management
πŸ’¬ Discuss
βœ… Correct Answer: (C) Change detection
Explanation: Zone.js is used to detect changes and trigger Angular's change detection.

Q. Which Angular feature helps to lazy load modules?

  • (A) PreloadingStrategy
  • (B) Route Guards
  • (C) loadChildren
  • (D) NgSwitch
πŸ’¬ Discuss
βœ… Correct Answer: (C) loadChildren
Explanation: loadChildren enables lazy loading of Angular modules.

Q. Which Angular service handles navigation between views?

  • (A) ViewService
  • (B) HttpClient
  • (C) Router
  • (D) NavigationService
πŸ’¬ Discuss
βœ… Correct Answer: (C) Router
Explanation: Angular's Router service handles navigation and routing.

Q. Which strategy improves Angular app performance by reducing change detection cycles?

  • (A) Default strategy
  • (B) Manual rendering
  • (C) OnPush strategy
  • (D) Detached strategy
πŸ’¬ Discuss
βœ… Correct Answer: (C) OnPush strategy
Explanation: OnPush change detection strategy improves performance by checking only when inputs change.