Angular JS MCQ (Multiple Choice Questions)

This set of Multiple Choice Questions & Answers (MCQs) focuses on “Angular JS”.

1. Which of the following statement is true for AngularJS?
a) AngularJS is a closed-source front-end web framework
b) AngularJS is an open-source front-end web framework
c) AngularJS is an open-source backend web framework
d) AngularJS is a closed-source back-end web framework
View Answer

Answer: b
Explanation: AngularJS is an open-source front-end web framework for constructing single-page apps based on JavaScript. The MEAN stack, which consists of MongoDB database, Express. js web application server framework, AngularJS (or Angular), and Node, uses AngularJS as the frontend.

2. Which of the following is the correct syntax for writing AngularJS expressions?
a) {{expression}}
b) {{expression | filter1 | filter2 | …}}
c) Both of the mentioned
d) None of the mentioned
View Answer

Answer: a
Explanation: The syntax for writing AngularJS expressions is:
{{expression}}
The syntax for applying multiple filters in AngularJS is:
{{expression | filter1 | filter2 | …}}

3. Which of the following components can be injected as a dependency in AngularJS?
a) factory
b) service
c) value
d) All of the above
View Answer

Answer: d
Explanation: Dependencies are injected in Angular.JS by using an “injectable factory method” or “constructor function.” As dependencies, these components can be injected with “service” and “value” components.
advertisement
advertisement

4. Which of the following directives is used to start an angularJS application?
a) ng-repeat
b) ng-init
c) ng-app
d) ng-model
View Answer

Answer: c
Explanation: Dependencies are injected in Angular.JS by using an “injectable factory method” or “constructor function.” As dependencies, these components can be injected with “service” and “value” components.

5. AngularJS expressions bind AngularJS data to HTML like which of the following directive?
a) ng-repeat
b) ng-bind
c) ng-app
d) ng-model
View Answer

Answer: b
Explanation: In AngularJS, the ng-bind directive is used to bind/replace the text content of any HTML element with the value specified in the expression. When the value of the expression in the ng-bind directive changes, the value of the provided HTML content changes.

6. Which of the following can be used as a prefix for Directive?
a) data-
b) ng-
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: The majority of AngularJS directives begin with the prefix ng. The letter ng stands for angular. However, x- or data- can also be used as a prefix.

7. What is a Model in MVC?
a) the lowest level of the pattern responsible for maintaining data
b) represents server-side data
c) represents data stored in a database
d) None of the mentioned
View Answer

Answer: a
Explanation: M stands for Model in MVC, and Model is a standard C# class. The model is in charge of data and business logic. The shape of the data is represented by a model.
advertisement

8. Being a JavaScript-only framework, applications written in AngularJS are not safe and secure.
a) false
b) true
View Answer

Answer: b
Explanation: Because AngularJS is a JavaScript-only framework, applications created with it are not secure. To keep an application safe, server-side authentication and permission are required.

9. Which of the following statement is correct about data binding in AngularJS?
a) Automatic synchronization of data between model and view components
b) Automatic synchronization of data between model and controller components
c) Technique to save html data in the database
d) Technique to bind database data to html control
View Answer

Answer: a
Explanation: The automatic synchronization of data between the model and view components is known as data-binding in Angular apps. In your application, data binding allows you to treat the model as the one source of truth.
advertisement

10. Which of the following is an advantage of AngularJS?
a) Uses dependency injection and makes use of separation of concerns
b) Code is unit-testable
c) Provides reusable components
d) All of the mentioned
View Answer

Answer: d
Explanation: Benefits of using angularJS:
i) Allows for easy application integration and takes advantage of Dependency Injection
ii) For web app development, it uses old simple JavaScript codes
iii) Marks up live bindings in the data object module quickly (DOM)

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.