PrototypeJS Javascript Framework MCQs

PrototypeJS Javascript Framework MCQs

Answer these 90+ PrototypeJS Javascript Framework MCQs and assess your grip on the subject of PrototypeJS Javascript Framework.
Scroll below and get started!

1: Prototype is considered what kind of framework?

A.   An HTML framework.

B.   A JavaScript framework for developing dynamic web applications.

C.   A network framework.

D.   A programming framework.

2: Date class is an extension to the built-in Date object and has two instance methods:

A.   Correct

B.   Correct. In addition to the given statement it has one class method.

C.   The second statement is incorrect

D.   The first statement is incorrect

3: Which of the following is not a targeted platform for development?

A.   Apple Safari

B.   Mozilla Firefox

C.   Microsoft Internet Explorer

D.   Netscape Navigator

4: Prototype.K(43560) returns what?

A.   1

B.   5

C.   43560

D.   250

5: What is the result of having the prototype of the native browser objects extended?

A.   All DOM elements have Prototype extensions built-in.

B.   It is now possible to add Prototype extensions.

C.   It is now possible to add Dom elements.

D.   It is now possible to add Prototype elements.

6: Which code segment has been written using Element#on?

A.   $$('#items li').each( function(item) {

B.   $("messages").observe("click", function(event) {

C.   $("messages").stopObserving("click", this.clickHandler);

D.   $("messages").on("click", "a.comment_link", function(event, element) {

7: How can you get access to the DOM element using Prototype?

A.   $(id), where id is a string.

B.   $(id) or $(element), where id is a string and element is an Element itself.

C.   $$(id) where id is a string.

D.   $(element) where element is an Element itself.

8: What is the correct syntax for a string of key-value pairs?

A.   &limit=12

B.   example&limit=12company=

C.   company=example&limit=12

D.   company=limit=12

9: DOM is an acronym for?

A.   Document Oriented Model

B.   Document Order Maintenance

C.   Direct Object Management

D.   Document Object Model

10: The dollar sign method $() returns what?

A.   Nothing

B.   An DOM element that matches the id passed extended with Prototype methods

C.   A list of DOM elements that match the CSS selector passed

D.   Boolean true

E.   An document element that matches the id passed

11: What is JSON's meaning and purpose?

A.   JavaScript Order Notion, and JSON is a lightweight data-interchange format.

B.   JavaScript Oblique Nation, and JSON is a lightweight data-interchange function.

C.   JavaJava Orbit Notation, and JSON is a lightweight data-conversion format.

D.   JavaScript Object Notation, and JSON is a lightweight data-interchange format.

12: Which of these is NOT a namespace in PrototypeJS? Event Abstract Number Ajax Enumerable Class Hash

A.   Hash

B.   Class

C.   Number

D.   All of these are namespaces in PrototypeJS

E.   Abstract

13: The IE properties, offsetWidth and clientHeight along with computed CSS are able to measure elements. Why not use them?

A.   The version of Prototype has changed so they are incompatible.

B.   IE properties struggle with “offset” vs. “client” dimensions, and CSS units need to be converted to be compatible.

C.   They are both outdated.

D.   There is no problem in using them since they are powerful and accurate parameters.

14: If you want to create a hash, which utility would you use?

A.   $Q()

B.   $Z()

C.   $F()

D.   $H()

15: Instance method String#extractScripts():

A.   Extracts the content of any <script> blocks present in the html page and returns them as a string.

B.   It evaluates the scripts

C.   Returns boolean

D.   Extracts the content of any <script> blocks present in the html page and returns them as an array of strings.

16: To make a contribution of patches or tests to prototypejs.org, you may NOT need:

A.   Rake library

B.   Code editor

C.   Gnu Linux distributive installed on the machine you are working on

D.   A recent version of Ruby

17: Internet Explorer doesn't allow the extension of what onto NodeList.prototype?

A.   NodeList

B.   Numerable

C.   Enumerable

D.   Numerical

18: If you wanted to extend all elements with an additional method to do 'foo' and you have already created the method foo() how would you add it?

A.   $.fn.foo = foo;

B.   Element.addMethods({'foo' : foo});

C.   $('emelent').foo() = foo

A.   application/x-ecmascript

B.   text/javascript

C.   application/ecmascript

D.   application/ext-javascript

20: Do Element.Layout#get and Element#measure work together?

A.   Not currently, but in the next version of Prototype.

B.   Yes.

C.   Only in the previous version of Prototype.

D.   No.

21: Instance method String#evalJSON():

A.   Does not exist, it is a class method

B.   Evaluates the string as JSON and returns the resulting object

C.   Evaluates the string as JSON and returns a string

D.   Evaluates the string as JSON and returns an integer

22: What object is informed about every AJAX request?

A.   Responders.Ajax

B.   Ajax.Element

C.   Ajax.Responders

D.   Element.Ajax

23: After editing your browser script to work with Prototype extensions, what coding can you add to the end to make it function more solidly?

A.   Element.extend(my_div)

B.   (my_div)Element.extend

C.   Element.extend

D.   Element.(my_div)

24: What is the value of t at the end of this code snippet? var t = 1; $R(0,100,true).each(function(){ t++; }); console.log(t);

A.   1

B.   101

C.   100

D.   true

E.   None of these

25: Which namespace is not typically used directly but mixed in to other namespaces?

A.   String

B.   Enumerable

C.   Template

D.   Array

E.   Number

26: Element#on has what distinct and beneficial features in Prototype 1.7?

A.   Better support for event deletion and extended element handler removal.

B.   Neglibable support for object delegation and sanctified element handler removal.

C.   Better support for event delegation and simplified event handler removal.

D.   Better support for element delegation and simplified event removal.

27: How can you inherit from a Storage class?

A.   var Descendant = new Class(Storage, { newmethod: function() { } });

B.   There is no class-inheritance in the Prototype javascript framework.

C.   After defining a Descendant using Class.create() method, inherit from class Storage by calling Descendant.inherits() method.

D.   After defining a descendant using Class.create() method, inherit from class Storage by using Object.extend() method.

28: Which of the following is not an example of an AJAX callback?

A.   onComplete

B.   onSuccess

C.   onInteractive

D.   onException

29: What code will return an instance of Element.Layout?

A.   var layout = $('troz').getLayout();

B.   var layout.getLayout();

C.   $('#troz').getLayout();

D.   Get.Layout();var layout = $('troz')

30: How would you wait for the DOM to be loaded so that you can start manipulating the page with Javascript?

A.   $(document).ready(function(){ //code here });

B.   document.ready(function(){ //code here });

C.   document.observe('dom:loaded',function(){ //code here });

31: What solution has Prototype 1.7 introduced to provide a more concise API?

A.   Element.Limit

B.   Event.Layout

C.   Element.Laundry

D.   Element.Layout

32: In the context of Prototype, “safe” means that AJAX will function how?

A.   On a single browser.

B.   Inter-browser.

C.   Cross-browser

D.   On no browser at all.

33: Lets say you have an array with name myArray. How would you organize a loop?

A.   Using "for" statement or Array#iter iterator.

B.   Using "for" statement or Array#each iterator.

C.   Using Array#prototype iterator or "for" statement.

D.   Using "for" statement only, Array#each is not an iterator.

34: Element#measure(property) gives:

A.   value(not only in pixels) of the screen dimension specified by property

B.   pixel value of an element's dimension specified by property

C.   nothing because it does not exist

D.   pixel value of the screen dimension specified by property

35: By using the Element#on object in Prototype event API, what benefit is being gained?

A.   Concisely written code and event delegation from outside a container.

B.   Concisely written code and event delegation from within a container.

C.   Obtusely written code and event delegation from within an object.

D.   Negligible written code and object delegation from within a container.

36: When using data from an untrusted source, it should be sanitized. What does this entail?

A.   Blocking users from entering any input.

B.   Removing malicious data from user input.

C.   Removing all user input.

D.   Increasing malicious data in user input.

37: If your data is not an instance of an object and you invoke the toJSON method, where should the syntax: toJSON() be located in the string?

A.   At the beginning.

B.   At the end.

C.   In the middle.

D.   Nowhere in the string.

38: What is the alternative of Element.extend() function in Prototype?

A.   The dollar function $()

B.   addClassName()

C.   createElement()

D.   appendChild()

39: You have a class that inherits from a parent class. How do you call a parent version of a class method from within a child class method of the same name?

A.   function($parent){ $parent() }

B.   function($super){ $super() }

C.   function(){ parent() }

D.   function(parent){ parent() }

40: The actual Ajax requests are made by creating instances of

A.   Ajax.Response object

B.   XmlHttpRequest object

C.   Ajax.Request object

D.   Ajax.apicall object

41: Evaluate the following statement: Hash is a set of key/value pairs with Element.Layout subclass. For convenience a developer can use #H() alias.

A.   More than one statements are incorrect.

B.   Hash is a set of key/value pairs, has Element.Layout subclass but there is no aliases defined for Hash in Prototype.

C.   One statement is incorrect.

D.   Correct

42: (42).toPaddedString(4) returns what?

A.   0042

B.   042

C.   4200

D.   42

43: What object is used to parse JSON?

A.   eval#StringJSON

B.   String#eval

C.   String#evalJSON

D.   String#evalJava

44: How would you remove a class named 'removeclass' from an element?

A.   There is not a method to remove class names

B.   $('element').removeClassName('removeclass');

C.   $('#element').className.replace('removeclass','');

D.   $('#element').removeClass('removeclass');

45: Which four utilities does Prototype use?

A.   $P $w $H $Q

B.   $S $P $Q $R

C.   $A $w $H $R

D.   $B $w $Z $R

46: How to create (define) a class with the name Storage in Prototype Javascript framework?

A.   var Storage = new Object();

B.   var Storage = Class.create();

C.   className = function() {}; Storage = new className();

D.   var Storage = Class.extend({ init: function(item){ this.item = item; }, doSomething: function() { } });

47: How to receive width of an element with id='div1' in pixels?

A.   by using $('div1').width; or by using $('div1').getStyle('width');

B.   by using $('div1').offsetWidth; or by using $('div1').getStyle('width');

C.   by using $('div1').clientWidth; or by using $('div1').getStyle('width');

D.   by using #('div1').offsetWidth; or by using #('div1').getStyle('width');

48: Prototype 1.6 introduced Element.Layout, which can be used for retrieving element measurements

A.   Correct

B.   The first statement is incorrect, right version of introduction is 1.7. Second statement is correct for 1.7

C.   Both statements are incorrect

D.   The second statement is incorrect

49: "data-my-element-info-t".camelize() returns what?

A.   dataMyElementInfoT

B.   A javascript error

C.   MyElementInfoT

D.   DataMyElementInfoT

E.   myelementinfot

50: Evaluate the following statement: Function class is an extension of a built-in Function object and has no class methods of its own.

A.   Incorrect

B.   Correct

C.   Correct for Prototype 1.7.2, incorrect for Prototype 1.6.0

D.   It is an extension of build-in Function object but has at least one class method of its own