Angular MCQs – Deployment and Best Practices

11.) Which file contains Angular environment configurations?

A) angular.json
B) environment.ts
C) config.json
D) package.json

Answer: Option B

Explanation: The environment.ts file stores API keys, backend URLs, and other configurations.

12.) Which Angular feature helps reduce the initial JavaScript bundle size?

A) Minification
B) Webpack
C) Service Workers
D) Lazy Loading

Answer: Option D

Explanation: Lazy Loading loads modules only when needed, reducing the initial bundle size.

13.) What is the best way to handle errors in a deployed Angular app?

A) Logging errors in the console
B) Using a global error handler
C) Disabling error messages
D) Restarting the server

Answer: Option B

Explanation: A global error handler helps catch and log errors efficiently in production.

14.) What does ng lint do in Angular?

A) Deploys the application
B) Fixes TypeScript errors
C) Checks code for best practices
D) Tests application performance

Answer: Option C

Explanation: ng lint analyzes TypeScript and HTML files to enforce best coding practices.

15.) What is PurgeCSS used for in Angular?

A) Debugging
B) Removing unused CSS
C) Optimizing JavaScript
D) Improving accessibility

Answer: Option B

Explanation: PurgeCSS removes unused CSS, reducing CSS file size in production.

16.) How can Angular optimize images for deployment?

A) Using WebP format
B) Compressing images
C) Lazy loading images
D) All of the above

Answer: Option D

Explanation: Using WebP, compression, and lazy loading improves image performance.

17.) What is the purpose of Source Maps in Angular?

A) Debugging production code
B) Improving performance
C) Reducing bundle size
D) Enabling offline support

Answer: Option A

Explanation: Source Maps help debug minified JavaScript code in production.

18.) Which Angular directive helps improve security?

A) ngIf
B) ngClass
C) ngSanitize
D) ngModel

Answer: Option C

Explanation: ngSanitize prevents XSS attacks by sanitizing HTML content.

19.) Which command updates Angular dependencies?

A) ng update
B) npm install
C) ng upgrade
D) ng refresh

Answer: Option A

Explanation: ng update updates Angular packages to the latest version.

20.) What is an important step before deploying an Angular app?

A) Running tests
B) Checking performance
C) Optimizing assets
D) All of the above

Answer: Option D

Explanation: Testing, performance checks, and asset optimization ensure a smooth deployment.

Leave a Reply

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