Create New Post

AngularJS MCQs - 2

  1. Which directive is used to include external HTML templates in AngularJS?

    • A) ng-include
    • B) ng-template
    • C) ng-html
    • D) ng-external

    Answer: A) ng-include

  2. What does $routeProvider do in AngularJS?

    • A) It defines routes for navigation in the application.
    • B) It provides access to route parameters.
    • C) It defines controllers for different routes.
    • D) It initializes the AngularJS application.

    Answer: A) It defines routes for navigation in the application.

  3. Which AngularJS directive is used to handle events?

    • A) ng-click
    • B) ng-model
    • C) ng-show
    • D) ng-bind

    Answer: A) ng-click

  4. What is the purpose of ng-disabled directive in AngularJS?

    • A) It disables data binding for an element.
    • B) It disables input fields in a form.
    • C) It disables event handling for an element.
    • D) It disables an HTML element based on an expression.

    Answer: D) It disables an HTML element based on an expression.

  5. Which built-in filter is used for filtering items in an array based on a search criteria?

    • A) filter
    • B) search
    • C) find
    • D) match

    Answer: A) filter

  6. What is the purpose of $rootScope in AngularJS?

    • A) It represents the root scope of the application.
    • B) It represents the scope of a specific controller.
    • C) It represents the scope of a specific directive.
    • D) It represents the scope of a specific service.

    Answer: A) It represents the root scope of the application.

  7. Which directive is used to bind HTML content to an AngularJS expression securely?

    • A) ng-bind-html
    • B) ng-html-bind
    • C) ng-secure-bind
    • D) ng-html-bind-secure

    Answer: A) ng-bind-html

  8. What is the purpose of ng-submit directive in AngularJS?

    • A) It binds a form submission event to a function.
    • B) It disables form submission.
    • C) It initializes form validation.
    • D) It submits a form automatically.

    Answer: A) It binds a form submission event to a function.

  9. Which AngularJS service is used for communicating between components in AngularJS applications?

    • A) $rootScope
    • B) $broadcast
    • C) $emit
    • D) $scope

    Answer: B) $broadcast

  10. What does $q service provide in AngularJS?

    • A) It provides methods for making HTTP requests.
    • B) It provides methods for managing promises.
    • C) It provides methods for routing in the application.
    • D) It provides methods for animation.

    Answer: B) It provides methods for managing promises.

Comments

Leave a Reply

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

38751