Create New Post

AngularJS MCQs - 6

  1. Which AngularJS directive is used to dynamically change the content of HTML elements based on an expression?

    • A) ng-show
    • B) ng-bind
    • C) ng-if
    • D) ng-switch

    Answer: D) ng-switch

  2. What does ng-controller directive do in AngularJS?

    • A) It defines a new controller in AngularJS.
    • B) It initializes the AngularJS application.
    • C) It binds a controller to a specific HTML element.
    • D) It hides an element until AngularJS has finished its compilation.

    Answer: C) It binds a controller to a specific HTML element.

  3. Which AngularJS service is used for creating custom filters in AngularJS applications?

    • A) $filter
    • B) $customFilter
    • C) $transform
    • D) $modifyFilter

    Answer: A) $filter

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

    • A) It binds the application data to the HTML view.
    • B) It initializes the AngularJS application.
    • C) It defines a new controller in AngularJS.
    • D) It initializes the scope variables.

    Answer: A) It binds the application data to the HTML view.

  5. Which AngularJS service is used for providing animations in AngularJS applications?

    • A) $animate
    • B) $animation
    • C) $angularAnimate
    • D) $animationService

    Answer: A) $animate

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

    • A) It defines a new controller in AngularJS.
    • B) It initializes the AngularJS application.
    • C) It hides an element until AngularJS has finished its compilation.
    • D) It specifies where to render templates for different routes.

    Answer: D) It specifies where to render templates for different routes.

  7. Which AngularJS service is used for intercepting HTTP requests and responses?

    • A) $httpInterceptor
    • B) $httpInterceptorProvider
    • C) $http
    • D) $httpProvider

    Answer: A) $httpInterceptor

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

    • A) It initializes the AngularJS application.
    • B) It defines a new controller in AngularJS.
    • C) It specifies where to insert content from a transcluded directive.
    • D) It hides an element until AngularJS has finished its compilation.

    Answer: C) It specifies where to insert content from a transcluded directive.

  9. Which AngularJS service is used for mocking HTTP requests in unit tests?

    • A) $httpBackend
    • B) $httpMock
    • C) $httpFake
    • D) $httpTest

    Answer: A) $httpBackend

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

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

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

Comments

Leave a Reply

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

91924