Create New Post

AngularJS MCQs - 7

  1. What does ng-app directive do in AngularJS?

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It hides an element until AngularJS has finished its compilation.
    • D) It specifies the root element of the AngularJS application.

    Answer: D) It specifies the root element of the AngularJS application.

  2. Which AngularJS service is used for managing browser history and navigation?

    • A) $location
    • B) $navigate
    • C) $history
    • D) $browser

    Answer: A) $location

  3. What is the purpose of ng-repeat directive in AngularJS?

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It repeats a set of HTML elements for each item in a collection.
    • D) It hides an element until AngularJS has finished its compilation.

    Answer: C) It repeats a set of HTML elements for each item in a collection.

  4. Which AngularJS service is used for creating and managing promises?

    • A) $promise
    • B) $q
    • C) $deferred
    • D) $async

    Answer: B) $q

  5. What is the purpose of ng-href directive in AngularJS?

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It specifies the value of the href attribute in HTML elements.
    • D) It hides an element until AngularJS has finished its compilation.

    Answer: C) It specifies the value of the href attribute in HTML elements.

  6. What does ng-init directive do in AngularJS?

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It initializes scope variables in the current scope.
    • D) It specifies where to insert content from a transcluded directive.

    Answer: C) It initializes scope variables in the current scope.

  7. Which AngularJS service is used for defining routes and routing in AngularJS applications?

    • A) $route
    • B) $router
    • C) $routeProvider
    • D) $routerProvider

    Answer: A) $route

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

    • A) It prevents AngularJS from compiling the contents of an element.
    • B) It initializes the AngularJS application.
    • C) It defines a new controller in AngularJS.
    • D) It specifies where to render templates for different routes.

    Answer: A) It prevents AngularJS from compiling the contents of an element.

  9. Which AngularJS service is used for managing the application lifecycle events?

    • A) $appLifecycle
    • B) $rootScope
    • C) $scope
    • D) $lifecycle

    Answer: B) $rootScope

  10. What is the purpose of ng-template directive in AngularJS?

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It specifies where to render templates for different routes.
    • D) It defines a template that can be reused in AngularJS applications.

    Answer: D) It defines a template that can be reused in AngularJS applications.

Comments

Leave a Reply

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

12943