Q. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?

  • (A) HTMLElement.prototype(…)
  • (B) HTMLElement.prototype
  • (C) HTML.addmethods()
  • (D) HTML.elements(add)
πŸ’¬ Discuss
βœ… Correct Answer: (B) HTMLElement.prototype
Explanation: It is implementation-dependent whether classes defined by the host environment (such as the web browser) can be augmented using Object.prototype. In many web browsers, for example, you can add methods to HTMLElement.prototype and those methods will be inherited by the objects that represent the HTML tags in the current document.

Q. The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for

  • (A) declaring and loading modules
  • (B) loading and declaring modules
  • (C) declaring modules
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) declaring and loading modules
Explanation: Both the Dojo toolkit and Google’s Closure library define provide() and require() functions for declaring and loading modules.

Q. Consider the following code snippet :
var o = new F();
o.constructor === F
The output would be :

  • (A) false
  • (B) true
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) true
Explanation: The result is true: the constructor property specifies the class.

Q. The meaning for Augmenting classes is that

  • (A) objects inherit prototype properties even in dynamic state
  • (B) objects inherit prototype properties only in dynamic state
  • (C) objects inherit prototype properties in static state
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) objects inherit prototype properties even in dynamic state
Explanation: JavaScript’s prototype-based inheritance mechanism is dynamic: an object inherits properties from its prototype, even if the prototype changes after the object is created. This means that we can augment JavaScript classes simply by adding new methods to their prototype objects.

Q. The property of JSON() method is:

  • (A) it can be invoked manually as object.JSON()
  • (B) it will be automatically invoked by the compiler
  • (C) it is invoked automatically by the JSON.stringify() method
  • (D) it cannot be invoked in any form
πŸ’¬ Discuss
βœ… Correct Answer: (C) it is invoked automatically by the JSON.stringify() method
Explanation: The JSON format is intended for serialization of data structures and can handle JavaScript primitive values, arrays, and plain objects. It does not know about classes, and when serializing an object, it ignores the object’s prototype and constructor. If you call JSON.stringify() on a Range or Complex object, for example, it returns a string like {“from”:1, “to”:3} or {“r”:1, “i”:-1}.

Q. The method that can be used to create new properties and also to modify the attributes of existing properties is

  • (A) Object.defineProperty()
  • (B) Object.defineProperties()
  • (C) Both Object.defineProperty() and Object.defineProperties()
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both Object.defineProperty() and Object.defineProperties()
Explanation: When used to define new properties, any attributes you omit default to false. Therefore, both Object.defineProperty() and Object.defineProperties() can be used to create and modify the attributes.

Q. The Client-Side Databases are stored in the

  • (A) The JavaScript code
  • (B) User’s computer
  • (C) Both JavaScript code and User’s computer
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) User’s computer
Explanation: The actual client-side databases are stored on the user’s computer and are directly accessed by JavaScript code in the browser.

Q. Which of the following use the Web SQL Database?

  • (A) Chrome
  • (B) Firefox
  • (C) IE
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) Chrome
Explanation: Chrome, Safari, and Opera implemented the Web SQL Database API, but Firefox and IE have not, and likely never will.

Q. Which of the following are objective database and not a relational database?

  • (A) Web SQL Database
  • (B) FileSystem API
  • (C) IndexedDB
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) IndexedDB
Explanation: IndexedDB is an object database, not a relational database, and it is much simpler than databases that support SQL queries. It is more powerful, efficient, and robust than the key/value storage provided by the Web Storage API, however.

Q. In the IndexedDB database, database is defined as

  • (A) A collection of objects
  • (B) A collection of named object stores
  • (C) Objects collection
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) A collection of named object stores
Explanation: In the IndexedDB API, a database is simply a collection of named object stores.