Q. What is Angular primarily used for?

  • (A) Backend development
  • (B) Mobile app development
  • (C) Front-end web development
  • (D) Database management
πŸ’¬ Discuss
βœ… Correct Answer: (C) Front-end web development
Explanation: Angular is a front-end framework used for building dynamic web applications.

Q. Which architecture pattern does Angular follow?

  • (A) MVC
  • (B) MVVM
  • (C) MVP
  • (D) Flux
πŸ’¬ Discuss
βœ… Correct Answer: (A) MVC
Explanation: Angular follows the MVC (Model-View-Controller) architectural pattern.

Q. Which decorator is used to define a component in Angular?

  • (A) @NgModule
  • (B) @Injectable
  • (C) @Component
  • (D) @Directive
πŸ’¬ Discuss
βœ… Correct Answer: (C) @Component
Explanation: @Component decorator is used to define a component in Angular.

Q. What file is used to define the root module in Angular?

  • (A) main.ts
  • (B) index.html
  • (C) app.component.ts
  • (D) app.module.ts
πŸ’¬ Discuss
βœ… Correct Answer: (D) app.module.ts
Explanation: The root module is defined in app.module.ts in Angular applications.

Q. Which command is used to create a new Angular component?

  • (A) ng generate service
  • (B) ng new component
  • (C) ng generate component
  • (D) ng make component
πŸ’¬ Discuss
βœ… Correct Answer: (C) ng generate component
Explanation: To create a new component, the command is `ng generate component`.

Q. What does the Angular CLI stand for?

  • (A) Client Layer Interface
  • (B) Command Line Interface
  • (C) Client Launch Instance
  • (D) Code Layer Integration
πŸ’¬ Discuss
βœ… Correct Answer: (B) Command Line Interface
Explanation: CLI in Angular stands for Command Line Interface.

Q. Which directive is used for conditional rendering in Angular?

  • (A) *ngSwitch
  • (B) *ngIf
  • (C) *ngFor
  • (D) ngModel
πŸ’¬ Discuss
βœ… Correct Answer: (B) *ngIf
Explanation: *ngIf is used to conditionally include or exclude an element.

Q. What is the purpose of services in Angular?

  • (A) Creating components
  • (B) Data binding
  • (C) Handling dependency injection and reusable logic
  • (D) Styling components
πŸ’¬ Discuss
βœ… Correct Answer: (C) Handling dependency injection and reusable logic
Explanation: Services are used for business logic and sharing data across components.

Q. Which lifecycle hook is called once after the first ngOnChanges?

  • (A) ngOnInit
  • (B) ngDoCheck
  • (C) ngAfterViewInit
  • (D) ngOnDestroy
πŸ’¬ Discuss
βœ… Correct Answer: (A) ngOnInit
Explanation: ngOnInit is called once after the first ngOnChanges.

Q. What is data binding in Angular?

  • (A) Connecting CSS with HTML
  • (B) Linking a component’s logic to its template
  • (C) Injecting a service into a component
  • (D) Connecting backend with frontend
πŸ’¬ Discuss
βœ… Correct Answer: (B) Linking a component’s logic to its template
Explanation: Data binding connects the component logic with its template.