Create New Post

AngularJS MCQs - 5

  1. Which AngularJS directive is used to dynamically add or remove HTML elements based on an expression?

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

    Answer: A) ng-if

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

    • A) It binds a key press event to a function.
    • B) It initializes the AngularJS application.
    • C) It defines a new controller in AngularJS.
    • D) It binds a key press event to an input element.

    Answer: A) It binds a key press event to a function.

  3. Which AngularJS service is used for accessing browser's history and location information?

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

    Answer: A) $location

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

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

    Answer: A) It binds a mouseover event to a function.

  5. Which AngularJS directive is used to initialize AngularJS applications?

    • A) ng-app
    • B) ng-init
    • C) ng-controller
    • D) ng-model

    Answer: A) ng-app

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

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

    Answer: A) It binds a blur event to a function.

  7. Which AngularJS service is used for injecting dependencies into controllers, services, and other AngularJS components?

    • A) $injector
    • B) $provider
    • C) $dependency
    • D) $inject

    Answer: A) $injector

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

    • A) It binds a submit event to a function.
    • B) It initializes the AngularJS application.
    • C) It defines a new controller in AngularJS.
    • D) It submits a form automatically.

    Answer: A) It binds a submit event to a function.

  9. Which AngularJS directive is used for creating custom directives in AngularJS applications?

    • A) ng-directive
    • B) ng-custom
    • C) ng-create
    • D) ng-directive-name

    Answer: D) ng-directive-name

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

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

    Answer: A) It binds a focus event to a function.

Comments

Leave a Reply

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

75190