Q. Which Angular concept allows a component to be used without being declared in a module?

  • (A) Dynamic component
  • (B) Standalone component
  • (C) Lazy-loaded component
  • (D) Global component
πŸ’¬ Discuss
βœ… Correct Answer: (B) Standalone component
Explanation: Standalone components can be used without being declared in an NgModule.

Q. Which RxJS operator is used to transform emitted items from an observable?

  • (A) catchError
  • (B) map
  • (C) filter
  • (D) tap
πŸ’¬ Discuss
βœ… Correct Answer: (B) map
Explanation: The `map` operator transforms the emitted items of an Observable.

Q. What is the purpose of a Resolver in Angular routing?

  • (A) To restrict access to routes
  • (B) To fetch data before route activation
  • (C) To log route changes
  • (D) To handle errors in routing
πŸ’¬ Discuss
βœ… Correct Answer: (B) To fetch data before route activation
Explanation: Resolvers pre-fetch data required for a route before the route activates.

Q. Which method is used to register a route guard in Angular?

  • (A) canActivate
  • (B) registerGuard
  • (C) useGuard
  • (D) setRouteGuard
πŸ’¬ Discuss
βœ… Correct Answer: (A) canActivate
Explanation: `canActivate` is used to control access to routes using guards.

Q. Which directive is used to apply dynamic styles in Angular?

  • (A) ngStyle
  • (B) ngIf
  • (C) ngSwitch
  • (D) ngClass
πŸ’¬ Discuss
βœ… Correct Answer: (A) ngStyle
Explanation: ngStyle is used to bind dynamic inline styles.

Q. What is the role of the 'trackBy' function in *ngFor?

  • (A) To filter items
  • (B) To style items
  • (C) To improve performance by tracking item identity
  • (D) To prevent rendering
πŸ’¬ Discuss
βœ… Correct Answer: (C) To improve performance by tracking item identity
Explanation: trackBy improves performance by tracking the identity of items.

Q. What is the default ChangeDetectionStrategy in Angular?

  • (A) Manual
  • (B) Optimized
  • (C) OnPush
  • (D) Default
πŸ’¬ Discuss
βœ… Correct Answer: (D) Default
Explanation: Angular uses the Default change detection strategy unless OnPush is specified.

Q. What is used to perform unit testing in Angular?

  • (A) Karma and Jasmine
  • (B) Mocha and Chai
  • (C) Jest and Enzyme
  • (D) QUnit and Sinon
πŸ’¬ Discuss
βœ… Correct Answer: (A) Karma and Jasmine
Explanation: Karma is the test runner and Jasmine is the testing framework used by Angular.

Q. Which keyword is used for dependency injection in a constructor?

  • (A) inject
  • (B) import
  • (C) private/public/protected
  • (D) new
πŸ’¬ Discuss
βœ… Correct Answer: (C) private/public/protected
Explanation: Access modifiers like private/public allow Angular to inject services into constructors.

Q. What does Angular use internally for reactivity and asynchronous programming?

  • (A) Promises
  • (B) Observables
  • (C) Callbacks
  • (D) async/await
πŸ’¬ Discuss
βœ… Correct Answer: (B) Observables
Explanation: Angular uses Observables (RxJS) for handling async data streams.