Web Designing and Publishing

JavaScript and Angular JS

  1. Which of following tag is used to link Javacript ?
    1. style
    2. link
    3. script
    4. jlink
    Answer : C
    Explain: script tag is used to link external Javascript.
  2. What is the extension of Javascript file ?
    1. css
    2. jsj
    3. jss
    4. js
    Answer : D
    Explain: Extension of javascript file is .js
  3. Which of the following is true about AngularJS expressions ?
    1. Expressions behave in same way as ng-bind directives
    2. Expressions are used to bind application data to html
    3. Expressions are written inside double braces like {{expression}}
    4. All of these
    Answer : D
    Explain: All the point regarding to angularJS is true.
  4. What MVC stands for?
    1. Model View Control
    2. Model Viewpoint Control
    3. Model View Controller
    4. Main View Control
    Answer : C
    Explain: Angular JS supports MVC, is used for software design.
  5. What is a Model in MVC ?
    1. the lowest level of the pattern responsible for maintaining data
    2. represents server-side data
    3. represents data stored in a database
    4. None of these
    Answer : A
    Explain: In MVC, Model- is responsible for maintaing the data.
  6. Which is the correct syntax to call an external JavaScript file in the current HTML document ?
    1. <script src=" test.js"></script>
    2. <script href=" test.js"></script>
    3. <import src=" test.js"></import>
    4. <import link=" test.js"></import>
    Answer : A
  7. Which statement specify correct difference between var and let keywords in JavaScript ?
    1. var defines a variable while let defines a constant.
    2. There is no such major difference between them.
    3. The value of a variable declared with var can be changed while the value of a variable declared with let cannot be changed.
    4. var defined function scoped variable while let define block scoped variable.
    Answer : D
    Explain: var and let are both used for variable declaration in javascript but the difference between them is that var is function scoped and let is block scoped.
  8. Which of the following is not a mouse event ?
    1. onclick
    2. onmousescroller
    3. onmouseover
    4. onmousemove
    Answer : B
    Explain: onmousemove, onmouseover and onclick are mouse event in HTML DOM Event.
  9. The correct syntax to write “Sky is blue” in JavaScript is :
    1. jscript.write(“Sky is blue”)
    2. document.write(“Sky is blue”)
    3. print(“Sky is blue”)
    4. jscript.print(“Sky is blue”)
    Answer : B
    Explain: document.write("text-here") is correct way to write any text.
  10. Wich of the following way to get element by ID ?
    1. document.getElementByclass
    2. document.getElementByid
    3. document.getElementByTag
    4. None of these
    Answer : B
    Explain: To get element by id we can use - document.getElementByid("id_name").
  11. Which of the following expressions is true ?
    1. { expression }
    2. [{ expression }]
    3. {{expression }}
    4. _expression }
    Answer : C
    Explain: {{ expression } is correct way.
  12. Which directive is used for data binding in AngularJS?
    1. ng-data
    2. ng-app
    3. ng-bind
    4. ng-controller
    Answer : C
    Explain: ng-bind is used to bind data in AngularJs.
  13. For what purpose Javascript is designed for ?
    1. To style HTML Pages
    2. To perform server-side scripting operation
    3. To execute the query related to DB on server
    4. To add interactivity to HTML Pages
    Answer : D
  14. AngularJS is a __________.
    1. HTML Framework
    2. .Net Framework
    3. JavaScript framework
    4. Oracle Framework
    Answer : C
    Explain: AngularJS is a javascript framework written in Javascript and structural framework use for dynamic web apps.
  15. What is a module in AngularJS ?
    1. expression
    2. application
    3. element
    4. None of above
    Answer : B
    Explain: An AngularJS module defines an application. The module is a container/box for the different parts of an application.
  16. The script tag must be placed in
    1. head tag only
    2. below title tag
    3. head or body tag
    4. body tag only
    Answer : C
    Explain: The script tag should either be included between the <head> tags or just before the closing <body> tag in your HTML document.
  17. A module in AngularJS can be created using :
    1. angularjs.module
    2. module.angular
    3. angular.modules
    4. angular.module
    Answer : D
    Explain: To create a module in AngularJS, we use angular. module("app").
  18. The alert() function in JavaScript is used for :
    1. To display a virtual alert box
    2. To display output on console
    3. To evaluate the expression
    4. Both (A) and (C)
    Answer : A
    Explain: alert() used to display virtual alet box on the screen.
  19. AngularJS developed by __________ and follows __________ .
    1. Amazon, Model View System
    2. Misko Hevery, Model View Controller
    3. Elon Musk, Model View Data
    4. Bill Gates, Spiral Model
    Answer : B
    Explain: AngularJS was created in 2009 by Miško Hevery, a developer working at Google and follows MVC.
  20. Which of the following directives are used in AngularJS ?
    1. ng - app
    2. nc - init
    3. Both A and B
    4. None of above
    Answer : A
    Explain: AngularJS directives are extended HTML attributes with the prefix ng-. So, ng-app is a directive here.

Make sure you make notes of these question. We hope it helps you.