Do you know that? For web developers it is $30 - $59/hr next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Upwork (oDesk) test answers << General Programming category

Test answers for Knowledge of Prototype Skills Test 2016

(78) Last updated: March 26
Upwork (oDesk) • General Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

78 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
1. Which of the following ways can you use to check whether prototype is loaded or not?

Answers:

• typeof(Prototype) === "object"

• typeof(Prototype) == "String"

• typeof(Prototype) == "function"

• There is no way to do that.

2. Which of the following form's functions allows you to submit a form using Ajax?

Answers:

• request

• call

• get

• post

3. Consider the following code snippet:

Sortable.create("id1");

Assume that nodes which id: id11, id12 are children of id1 and nodes which id: id111, id112 are children of id11. Which of the following elements can be sortable?

Answers:

• id11 and id12

• id111 and id112

• all

• none

4. What does the following statement return?
fom1.findFirstElement();

Answers:

• The first non-hidden, non-disabled control of form1 form.

• The first control of form1 form.

• The first hidden control of form1 form.

• This statement is invalid.

5. Which of the following code snippets is the proper way to define a class in prototype?

Answers:

• var Point = Class.create({initialize: function(x, y) {this.x = x; this.y = y;}});

• var Point = function(x, y) {this.x = x; this.y = y;}

• var Point = Class({Point: function(x, y) {this.x = x; this.y = y;}});

• class Point {function Point(x, y) {this.x = x; this.y = y;}};

6. Which of the following statements displays prototype version of Prototype?

Answers:

• Prototype.Version

• $.Version

• VersionOf("Prototype")

• VersionOf($);

7. The number of arguments of Try.these() are ___.

Answers:

• 2

• 4

• 6

• infinite

8. Which of the given options is the result of the following code snippet?

new Builder.node("div", {className: "error"}, "Error");

Answers:

• Change innerHTML of div tags that have "error" class to Error.

• Change class of div tags that contain "Error" to "error".

• Create a div tag that has "error" as class name and contains "Error" text.

• This code snippet is invalid.

9. Which of the following parameters is/are valid parameter(s) of Effect.Highlight() method?

Answers:

• startColor

• end-color

• restorecolor

• border-color

10. What is the result of "thisisprototype".camelize(); statement?

Answers:

• thisisprototype

• thisIsPrototype

• ThisIsPrototype

• THISISPROTOTYPE

11. What is the valid range of $R(1, 10, true);?

Answers:

• 1 to 9

• 1 to 10

• 2 to 9

• 2 to 10

12. What is the result of the following code snippet?

el.insert("«span»Prototype«/span»");

Answers:

• «span«Prototype«/span« will be the last child of el.

• «span«Prototype«/span« will be the first child of el.

• «span«Prototype«/span« will replace innerHTML of el.

• This code snippet is invalid.

13. Consider the following code snippet:

Element.addMethods({
 : show: function(element) {
 : alert("This is prototype.");
  }
});

What does this code snippet do?

Answers:

• It adds show method to all elements.

• It adds show method to "element" element.

• This code snippet is invaid.

14. Which of the following functions allows/allow you to register an event to an element?

Answers:

• Event.observe

• Element.observe

• Event.register

• Element.register

15. Which of the following functions is used to call the initialize method of the parent class?

Answers:

• $super

• initialize

• Method has the same name as parent class name.

• It is not possible to call the initialize method of the parent class.

16. Which of the following methods allows you to add a new instance of method to a class after that class has been defined?

Answers:

• initialize

• constructor

• Method has the same name as class name.

• There is no constructor of prototype class.

17. If the server response time is slow, you may consider increasing the ___ option parameter to reduce the response time.

Answers:

• frequency

• wait

• interval

18. Consider the following code snippet:

new Effect.Scale("id1", arg2);

Which attribute(s) is id1 element scaled to?

Answers:

• width

• height

• font

• border

19. What is the value of $A($R('ab', 'ah'));?

Answers:

• ["ab", "ac", "ad", "ae", "af", "ag", "ah"]

• ["ac", "ad", "ae", "af", "ag"]

• ["ab", "ac", "ad", "ae", "af", "ag"]

• This statement is invalid.

20. How can you stop an event from propagating?

Answers:

• Event.stop

• Event.preventDefault

• Event.stopPropagation

• Event.preventPropagation

21. If you want to make an Ajax request using xml instead of the regular URL-encoded format, which option parameter do you have to change?

Answers:

• contentType

• method

• encoding

• It is not possible to send request using xml.

22. Which of the following options is/are valid element(s) of the function-
Form.Element.present(element);

Answers:

• input

• textarea

• button

• This function is invalid.

23. What does identify method of element do?

Answers:

• It returns element's ID. If element does not have an ID, one is generated, assigned to element, and returned..

• It returns the id of that element.

• It generates an id for that element.

• This method does not exist.

24. Which of the given values can be the value of arg in the following code snippet?

$("id1").insert(arg);

Answers:

• "<span>Prototype</span>"

• $("id2");

• new Element("span", "Prototype");

25. Which of the following is the result of "this_is_prototype".dasherize(); statement?

Answers:

• this-is-prototype

• thisisprototype

• ThisIsPrototype

• this is prototype

26. What does cleanWhiteSpace method of element do?

Answers:

• It removes all of element's child text nodes that contain only whitespace.

• It removes whitespace from element.

• It removes whitespace from the content of all child nodes.

• This method does not exist.

27. Which of the following methods allows you to add class to a class after that class is defined?

Answers:

• Class.addMethods

• Class.includeMethods

• Class.add

• Class.include

28. The callback function in options of Ajax.Autocomplete() is called ___ the request is actually made.

Answers:

• before

• after

29. How can you add class to id1 element?

Answers:

• id1.addClass("className");

• id1.addClassName("className");

• $("id1").add("className");

• $("id1").setClassName("className");

30. Consider the following code snippet:

var a = {framework: "Prototype", version: "1.6.1"};
var b = a.toObject();
alert(b.version);

What does the alert box display?

Answers:

• 1.6.1

• null

• undefined

• This code snippet causes an error.

31. Elements and ids can be interchangeable in function calls, if a function expects a document id.

Answers:

• True

• False

32. What does the following statement do?
new Ajax.Updater("el1", "/index");

Answers:

• It updates element that has "el1" id with the content response from /index page.

• It updates elements that have "el1" class with the content response from /index page.

• It updates "el1" element content with "/index" .

• This statement is invalid.

33. Which of the following functions returns the element that occurred?

Answers:

• Event.element

• Event.target

• Element.target

• Element.eventTarget

34. Which of the following is/are a valid callback of core effects?

Answers:

• beforeStart

• afterSetup

• beforeUpdate

• afterFinish

35. What is the result of b in the following code snippet?

var a = {name: "Prototype", version: "1.6.1"}
var b = Object.values(a);

Answers:

• ["Prototype", "1.6.1"]

• {name: "Prototype", version: "1.6.1"}

• [[name, "Prototype"], [version, "1.6.1"]]

• [{name: "Prototype"}, {version: "1.6.1"}]

36. Consider the following code snippet:

new Effect.Scale(agr1, arg2);

What is arg2 parameter?

Answers:

• Percentage to scale

• Number of times to scale

• Width

• Height

37. PeriodicalUpdater updates an element ___.

Answers:

• at the given frequency.

• with the specified number of times.

• at the given hours.

• This function does not exist.

38. Which of the following tags can make element draggable?

Answers:

• p

• span

• div

• li

39. Which of the following code snippets is the proper way to define a class that inherits another class?

Answers:

• var Dog = Class.create(Animal, {});

• var Dog = Class.inherit(Animal, {});

• var Dog = Class.extend(Animal, {});

• var Dog = Animal.extend({});

40. Which of the following functions updates an existing hash?

Answers:

• update

• merge

• delete

• remove

41. Which of the following methods can you use to fade in an element?

Answers:

• Effect.FadeIn();

• Effect.Fade();

• Effect.Show();

• Effect.Appear();

42. What does match method of element do?

Answers:

• It checks whether this element matches the given css selector.

• It checks whether this element matches the given id selector.

• It checks whether this element matches the given css or id selector.

• This method does not exist.

43. The time to complete an effect generally depends on the speed of the computer.

Answers:

• True

• False

44. You ___ create instances of Ajax.Response yourself.

Answers:

• do not need to

• have to

• can not

• are not allowed to

45. $("id1").wrap("div", {"class" : "container"});

Answers:

• This code snippet will wrap id1 in a div tag.

• This code snippet will wrap div tags that have "container" class in id1 element.

• This code snippet is invalid.

46. What is the difference between the names of native browser events and prototype custom events?

Answers:

• Custom events have a colon (:) in their name.

• Native browser events have a colon (:) in their name.

• Native browser event names are case-sensitive.

• There are no differences.

47. Which of the following methods allows you to set many style attributes in one call?

Answers:

• setStyle

• setStyles

• setAttribute

• setAttributes

48. When is the Ddom:loaded event fired?

Answers:

• Before the DOM tree is loaded.

• After the DOM tree is loaded, before window's load event.

• After load event.

• After an Ajax request finishes.

49. Which of the following objects allows you to monitor Ajax activities?

Answers:

• Ajax.Responders

• Ajax.Monitor

• Ajax.Response

• There are no such objects.

50. Which of the following element methods finds siblings of that element?

Answers:

• sibling

• adjacent

• children

• There is no such method.

51. Which of the following code snippets changes properties of element's css?

Answers:

• $('id1').morph("height: 200; width: 200;");

• $('id1').morph("height: 200", "width: 200");

• $('id1').morph("height: 200").morph( "width: 200");

• $('id1').morph({"height" =» "200", "width" =» "200");

52. You have a local autocomplete like the following:

new Autocompleter.Local(arg1, arg2, arg3, arg4);

Assume that you want to create a local autocomplete text field. You want to display all possible values on div1 div element and show this div to the user. Which of the following arguments is the value of div1 div?

Answers:

• arg1

• arg2

• arg3

• arg4

53. ___ extends event with all of the methods contained in Event.Methods.

Answers:

• Event.extend

• Event.include

• Event.inherit

• There is no method to do so.

54. What is the result of the following code snippet?
[1, 2, 3, 4, 5].map( function(num) { return num * num; } );

Answers:

• [1, 4, 9, 16, 25]

• 55

• 25

• This code snippet causes an error.

55. Which of the following effects are core effects?

Answers:

• Effect.Appear

• Effect.Opacity

• Effect.Tween

• Effect.Move

56. Consider the following code snippet:

var Animal = Class.create({initialize: function(wildOrNot, canFly) {this.wildOrNot = WildOrNot; this.canFly = canfly;}});
var Wolf = Class.create(Animal, {initialize: function($super, arg2) {$super("Wild", false); this.leatherColor = arg2}});

Which of the following is the proper way to create a Wolf object?

Answers:

• var aWolf = new Wolf("Yellow");

• var aWolf = new Wolf("Wild", false, "Yellow");

• var aWolf = new Wolf($super, "Yellow");

• var aWolf = new Wolf(Animal, "Yellow");

57. Which of the following functions converts html special characters to their entity equivalents?

Answers:

• escapeHTML

• escape

• removeHTML

• convertHTML

58. What is the result of the following code snippet?
[1, null, 2, false, 3].partition();

Answers:

• [[1, 2, 3], [null, false]]

• [1, 2, 3, null, false]

• [1, 2, 3]

• [null, false, 1, 2, 3]

59. What is the value of b in the following code snippet?

var a = ["this", "is", "prototype"];
var b = a.inject(0, function(c, d) {
return c + d.length;
});

Answers:

• 15

• 9

• 150

• This code snippet is invalid.

60. Consider the following code snippet:

1 $('id1').observe("click", function() {
2 new Effect.Highlight("id1", {startcolor: '#ff9999', endcolor: '#ffffff'});
3 return false;
4 });

If you click it once, then click it one more time while the it's highlighted, its highlighted color looks strange. Which of the following ways may fix that problem?

Answers:

• Change the second line to: new Effect.Highlight("id1", {startcolor: '#ff9999', endcolor: '#ffffff', queue: 'end'});

• Change return false; to return true;

• Change the first line to $('id1').observe("doubleclick", function() {

61. What does $F(element).getValue() return?

Answers:

• It returns the current value of a form control.

• It returns the value of function $F.

• It returns the value of any given element.

• This function is invalid.

62. What will be returned if Event.findElement("click", "div"); cannot find any elements that match the specified tag?

Answers:

• document

• null

• undefined

• The element that has registered click event handler.

63. Consider the following code snippet:

var template = new Template("This is #{framework} version #{version}");
var a = {framework: "Prototype", version: "1.6.1"}
var b = template.evaluate(a);

What is the result of b?

Answers:

• This is Prototype version 1.6.1

• This is #{framework} version #{version}

• This is 1.6.1 version Prototype

• This code snippet is invalid.

64. What is the result of 10.toColorPart(); statement?

Answers:

• 0a

• 10

• 1010

• This statement causes an error.

65. Which of the following statements is valid?

Answers:

• Object.isUndefined(a);

• a.isUndefined();

• isUndefined(a);

• isDefined(a);

66. Consider the following code snippet:

new Ajax.InPlaceEditor("id1", "save.jsp");

What is the request parameter name of id1 element on server When its value changes?

Answers:

• id1

• InPlaceEditor

• value

• This code snippet is incorrect.

67. Which of the following properties holds the number of active requests?

Answers:

• Ajax.activeRequestCount

• Ajax.numberActiveRequests

• Ajax.activeRequests

• There are no such properties.

68. Function.bind(object); will replace ___ variable in function by "object".

Answers:

• this

• document

• window

• function

69. __________ allows more than one effects to occur at the same time.

Answers:

• Effect.Parallel

• Effect.Asynchronous

• Effect.run

• There is no such method.

70. What does the statement $('item1', 'item2', 'item3'); return?

Answers:

• A collection of elements with item1, item2, item3 ids.

• A collection of elements that have one of the item1, item2, item3 classes.

• This statement is invalid.

71. What is the result of the following function?

function a() {
   var x = 10;
 return x.toPaddedString(4);
}

Answers:

• 0010

• 000a

• 10.00

• This function is invalid.

72. What is the result of "this is".include("prototype"); statement?

Answers:

• this is prototype

• prototype this is

• true

• false

73. Which of the following methods allows you to set element attributes?

Answers:

• setAttribute

• setAttributes

• writeAttribute

• writeAttributes

74. Which of the following code snippets moves id1 element?

Answers:

• new Effect.Move("id1", {0, 0, 'relative'});

• "id1".Move("x: 0; y: 0");

• "id1".Move(x: 0, y: 0, "left");

• new Effect.Move("id1", {x: 0, y: 0});

75. What is the result of the following code snippet?
[1, 2, 3, 4, 5].detect(function(n) {return n % 3});

Answers:

• 1

• 2

• 3

• 5

76. Consider the following code snippet:

var s = '';
(5).times(function(n) {
   s += n;
});
alert(s);
What does the alert box display?

Answers:

• 01234

• 55555

• 10

• Nothing

77. The difference between Effect.SlideUp and Effect.BlindUp is that ___.

Answers:

• Effect.BlindUp hides element from the bottom first, whereas Effect.SlideUp hides element from the top first.

• Effect.SlideUp moves the element up, whereas Effect.BlindUp hides the element.

• Effect.BlindUp removes the element, whereas Effect.SlideUp hides the element.

• There is no difference.

78. Which of the following functions fires a custom event?

Answers:

• Event.fire

• Event.execute

• Event.run

• There is no such method.