Angular MCQs – Angular Project Structure and Fundamentals

11.) What is a module in Angular?

A) A function that executes background tasks
B) A collection of components and services
C) A CSS styling framework
D) A single JavaScript file

Answer: Option B

Explanation: Angular modules organize the application by grouping related components, directives, and services.

12.) What is the main decorator used to define an Angular module?

A) @NgModule
B) @Injectable
C) @Directive
D) @Component

Answer: Option A

Explanation: The @NgModule decorator defines an Angular module, listing components, imports, and providers.

13.) What is Dependency Injection (DI) in Angular?

A) A method to directly access the database
B) A tool for debugging Angular applications
C) A design pattern to manage dependencies in a class
D) A function that manages component state

Answer: Option C

Explanation: Dependency Injection (DI) allows Angular to inject services and dependencies into components automatically.

14.) What is the purpose of the app-routing.module.ts file?

A) It sets up the database connection
B) It defines routes for navigation
C) It initializes the Angular application
D) It contains component logic

Answer: Option B

Explanation: The app-routing.module.ts file configures the routing paths for navigating between components.

15.) What is the purpose of the styles.scss file in an Angular project?

A) Handles routing information
B) Contains global styles for the application
C) Stores API configurations
D) Defines component logic

Answer: Option B

Explanation: The styles.scss file contains global styles that apply to the entire Angular application.

16.) Which of the following is NOT a part of the default Angular project structure?

A) src/
B) node_modules/
C) app.component.ts
D) server.js

Answer: Option D

Explanation: Angular projects do not include a server.js file by default. The project structure includes src/, node_modules/, and app.component.ts.

17.) What is the purpose of the tsconfig.json file in an Angular project?

A) It defines TypeScript configuration settings
B) It manages Angular routing
C) It contains project dependencies
D) It is used to write unit tests

Answer: Option A

Explanation: The tsconfig.json file configures TypeScript compiler options for the Angular project.

18.) Which file contains the main styles for an Angular project?

A) angular.json
B) main.ts
C) app.component.html
D) styles.css or styles.scss

Answer: Option D

Explanation: The styles.css or styles.scss file contains global styles applied across the Angular application.

19.) What is the purpose of the assets/ folder in an Angular project?

A) It stores compiled TypeScript files
B) It contains static resources like images, fonts, and JSON files
C) It holds Angular service files
D) It includes unit test cases

Answer: Option B

Explanation: The assets/ folder is used to store static files that can be used across the application.

20.) Which Angular CLI command compiles the project into a dist/ folder?

A) ng compile
B) ng serve
C) ng generate
D) ng build

Answer: Option D

Explanation: The ng build command compiles the project and outputs the production-ready files into the dist/ folder.

Leave a Reply

Your email address will not be published. Required fields are marked *