Knowledge of Mootools Skills Test Answers



1. State whether the following statement is True or False:

"The Flash file must use ExternalInterface class to register its functions to make these functions available to JavaScript so that these functions can be called using Swiff.remote function"
Answers:
• True
• False

2. Fill in the blank with the correct value:
The maximum number of arguments of onSuccess event of Request.HTML is ___.
Answers:
• 1
• 2
• 3
• 4
3. Fill in the blank with the correct option.

The ___ function will be executed each time an instance of a class is created.
Answers:
• initialize()
• create()
• new()
• construct
4. What is a valid value of $('e1').getStyle('width');?
Answers:
• 300
• 300px
• 300pt
• 300em
5. Fill in the blank with the correct phrase:

function1.bind(object1) function replaces ___ in function1 by object1.
Answers:
• The This keyword
• The first argument
• The first object
• None of the above.
6. What does $('div'); return?
Answers:
• An element with id div.
• Elements that have div class.
• The first div element.
• A collection of div elements.
7. Which of the following statements change the background color of id1 element to yellow?
Answers:
• $('id1').setStyle('background-color', 'yellow');
• document.getElementById('id1').setStyle('background-color', 'yellow');
• $('id1').set('background-color', 'yellow');
• a and b
• b and c
8. Fill in the blank with the correct word:

The onComplete event is fired if the request ___.
Answers:
• success or failure
• is canceled
• failure
• failure or is canceled
9. Complete the sentence with the correct option.

A class can inherit other class by using ___ property.
Answers:
• Extends
• extends
• Inherits
• inherits
10. Fill in the blank with the correct value:

The Drag class enables the modification of ___ CSS properties of an Element based on the position of the mouse while the mouse button is down.
Answers:
• 1
• 2
• 3
• more than 3
11. Consider the following code snippet:

    new Fx.Tween($('id1')).start('opacity', 0, 1);

Does the transition happen if the current opacity value of id1 element is 1?
Answers:
• Yes
• No
12. What does e1.grab(e2, 'top'); do?
Answers:
• Make e2 the first child of e1.
• Make e1 the first child of e2.
• Replace e1 by e2.
• Replace e2 by e1.
13. Fill in the blank with the correct word:

Implements is similar to Extends, except that it adopts properties from one or more other classes ___ inheritance.
Answers:
• without
• with
14. Consider the following:
    $('id1').load("data"):
What does the code snippet do?
Answers:
• Load data from "data" page to id1 element.
• Load data from function "data".
• Load value from "data" variable.
• Load id1 element content into "data" variable.
15. What does the code snippet do?

e1.cloneEvents(e2);
Answers:
• e1 element clones all events from e2 element.
• e2 element clones all events from e1 element.
• Duplicate event name e2 of e1 element.
• Duplicate event name e1 of e2 element.
16. What does e1.inject(e2); do?
Answers:
• Make e1 the last element of e2
• Make e1 the first element of e2
• Make e2 the last element of e1
• Make e2 the first element of e1
17. Which method can you use to make a div resizeable?
Answers:
• makeResizable
• allowResize
• makeSizeChangeable
• allowSizeChangeable
18. What does Swiff class do?
Answers:
• Create and return a Flash object.
• Create and show a Flash object on the document.
• Create and return a Java Aplet object.
• Create and return a Java Aplet object.
19. Consider the following code snippet:

    var a = 256;
    var b = a.limit(0, 100);
    alert(b);

What does the alert box display?
Answers:
• 0
• 99
• 100
• 256
20. What does the code snippet do?
    var css = Asset.css("css");
Answers:
• Load file "css" and links that file into header as css file.
• Create a css class.
• Apply "css" class to Asset element.
• This statement is invalid.
21. Consider the following code snippet:

    var global = 1;
    var a = new Chain();
    a.chain(
        function(){ global++;},
        function(){ global++;}
    );
    a.callChain();
    a.callChain();

What is the result of this code snippet?
Answers:
• 1
• 2
• 3
• 4
22. Consider the following code snippet:

    var a = ['Dog', 'Cat', 'Chicken'];
    a.combine(['Dog', 'cat']);
What is the result of a?
Answers:
• ["Dog", "Cat", "Chicken", "cat"]
• ["Dog", "Cat", "Chicken"]
• ["Dog", "Cat", "Chicken", "Dog", "cat"]
• ["Dog", "Cat", "Chicken", "Dog", "Cat"]
23. Assume that c1 element is the child of p1 element, how many times is the mouseenter event fired if the mouse moves from outside to p1 element, then over the c1 element?
Answers:
• 1
• 2
• 3
• 4
24. Consider the following code snippet:

    $$('div.e1').setStyle('background-color', 'yellow').addClass('floatBox');

How many times is each div element with e1 class iterated?
Answers:
• Once
• Twice
• It's equal to the number of div elements with e1 class.
• It's equal to twice the number of div elements with e1 class.
25. What does the following code snippet do?

    var img1 = new Element('img', {src:'img1.png'});
Answers:
• Create an image element and show it at the end of the document.
• Create an image element and show it at the top of the document.
• Create an image element object.
• Create a collection of existing image elements.
26. Consider the following code snippet:

var a = new Drag.Move($('id1'), {droppables: $('.droppables'), container: $('container'), handle: $('handler')});
Where can the id1 element drop into?
Answers:
• All elements that have droppables class.
• Anywhere.
• Anywhere in "container" element.
• This code snippet is invalid.
27. Consider the following code snippet:

    function function1 () {
        var a = document.getElementById();
        return a;
    }
    alert(function1.attempt());
What does the alert box display?
Answers:
• null
• true
• false
• There is no alert box.
28. Fill in the blank with the correct word:

Function.attempt function tries to execute a number of functions. Returns immediately the return value of the first ___ function without executing successive functions, or null.
Answers:
• true
• false
• failed
• non-failed
29. Which of the following methods removes an element from a Hash object?
Answers:
• remove
• delete
• erase
• pop
30. Consider the following code snippet:

    fx = new Fx.Tween($('id1'), {
        onComplete: function() {
            alert("Finish");
        }
    });
    fx.set('opacity', 0.5);

Does the onComplete event of fx fire after the opacity of id1 element is changed to 0.5 by the above-mentioned code?
Answers:
• Yes
• No
31. Consider the following code snippet:

    String.implement({log: function(){console.log(this)}});
What does this code snippet do?
Answers:
• It adds log function to predefined JavaScript String class.
• It adds log function to user's String class.
• It adds log function to String object.
• It runs implement function of String object as another function.
32. What is the valid direction of Fx.Slide?
Answers:
• Horizontal up
• Horizontal down
• Vertical left
• Vertical right
33. Consider the following code snippet:

    var a = Function.from(1.1);
    alert(a(10));

Which of the following does the alert box display?
Answers:
• 1
• 1.1
• 11
• There is no alert box.
34. Which option of Fx.Morph class can use to change the transition type?
Answers:
• transition
• link
• affect
• type
35. What does request.delete({name: 'mootools'}); do?
Answers:
• Delete request option value.
• Remove array element from request object.
• Send request as "delete" method.
• This statement is invalid.
36. Consider the body of a document below:

    <p>This is «p»This is mootools«/p»mootools too</p>
    <p>This is mootools</p>
    <p>This is Mootools</p>
    <script type="text/javascript">
        alert($$('p:contains(mootools)').length);
    </script>

What does the alert box display?
Answers:
• 1
• 2
• 3
• 4
37. $type(/abc/) returns ___.
Answers:
• string
• String
• regexp
• function
38. Consider the following code snippet:

    var a = [0, 3, 5].some(function(value) {return value % 3;});
What is the value of a?
Answers:
• true
• false
• null
• undefined
39. getSize() method returns width and height of an element, which value is counted in the height of the return value of getSize() function?
Answers:
• content area height
• padding top and bottom
• margin top and bottom
• border top width and border bottom width
40. Which options below change the href of a1 anchor link to http://www.google.com?
Answers:
• var a1 = $('a1'); a1.href="http://www.google.com";
• var a1 = $('a1'); a1["href"]="http://www.google.com";
• a and b.
• None of above.
41. Consider the following code snippet:

    new Fx.Tween($('id1')).start('opacity', 1);

Does the transition happen if the current opacity value of id1 element is 1?
Answers:
• Yes
• No
42. What does the following do?

«font size=2»
    $('id1').href = "http://mootools.net";
«font »
Answers:
• Create "href" attribute for element id1 if it does not exist and assign "http://mootools.net" variable to that attribute.
• Change the content of id1 element to "http://mootools.net".
• Change "href" attribute of id1 anchor to "http://mootools.net".
• This statement is invalid.
43. Which of the following methods can you use to make an element draggable?
Answers:
• makeDraggable
• draggable(true)
• makeDroppable
• droppable(true)
44. Which of the following functions removes cookie from the browser?
Answers:
• Cookie.dispose
• Cookie.delete
• Cookie.remove
• Cookie.empty
45. Fill in the blank with the correct word:
JSON.encode function converts any ___ into a JSON string.
Answers:
• object or array
• class
• string
• class or string
46. Consider the following code snippet:

    var rq1 = new Request('request1'});
    var rq2 = new Request('request2');
    var rq3 = new Request('request3');
    var group = new Group(rq1, rq2, rq3);
    group.addEvent('onComplete', function(){
        alert('Finished');
    });
    rq1.request();
    rq2.request();
    rq3.request();

When will the alert box be displayed?
Answers:
• All three requests finish.
• Each request finishes.
• rq1 finishes.
• rq3 finishes.
47. Which of the following is a valid mootools table class?
Answers:
• Table
• TABLE
• HtmlTable
• HTMLTABLE
48. Which of the following code snippets defines a class?
Answers:
• classA = new Class({x: 10});
• Class classA {x: 10}
• classA = Class.create({x: 10});
• classA = Class.new({x: 10});
49. What is the result of- alert($defined('«body»'));?
Answers:
• true
• false
• null
• undefined
50. Consider the following code snippet:

var animals = ['Cow', 'Pig', 'Dog'];
var sounds = ['Moo', 'Oink', 'Woof', 'Miao'];
var result = sounds.associate(animals);

What will alert(result.Miao) function show?
Answers:
• null
• Dog
• Undefined
• Cow
51. What does the statement 'moo tools'.contains('t', ' '); return?
Answers:
• true
• false
• null
• b
52. Which of the following functions can be used to load json data?
Answers:
• Request.JSON
• Request.Json
• json.request
• JSON.request
53. Consider the following code snippet:

    var a = new Fx.Morph($('id1'), {link: value});

Which value of "value" in this code snippet makes the new transitions stop the current transition?
Answers:
• cancel
• ignore
• chain
• stop
54. Consider the following code snippet:

    var a = $$('div');
    var b = a.filter('.blue');

What is the result of b?
Answers:
• All div elements that contain "blue" class.
• All div elements that do not contain "blue" class.
• All elements that contain "div" and "blue" class.
• All elements that do not contain "div" and "blue" class.
55. Fill in the blank with the correct option:
By default, the class Tips use the element's ___ to display tooltip.
Answers:
• rel and tip attributes
• description attribute
• title attribute
• title and description attributes
56. Is Fx.Morph class allows you to execute animation of more than one property at the same time?
Answers:
• Yes
• No
57. Which method below inserts css class to an element?
Answers:
• addClass
• toggleClass
• insertClass
• injectClass
58. Which method(s) below is valid request method(s)?
Answers:
• send
• POST
• post
• Post
59. Consider the following code snippet:

    var a = new $H({"a": 1, "b": 2});
    var b = a.toQueryString();
What is the result of b?
Answers:
• a=1&b=2
• b?a=1&b=2
• 1&2
• a:1&b:2
60. Consider the following code snippet:

    alert(1.1.floor());

Which of the following is displayed in the alert box?
Answers:
• 1
• 2
• null
• There is no alert box.
61. Fill in the blank with the correct words:

getRandom(); will get a random ___ from the ___.
Answers:
• element, array
• word, string
• letter, string
• number, range
62. What does the following do?
    request.put({name: 'mootools'});
Answers:
• Set request option value.
• Add array to request object.
• Send request as "put" method.
• This statement is invalid.
63. Fill in the blank with correct word.

Fx Events: onChainComplete: The function onChainComplete of Fx.Events is executed after ___ effect(s) in the chain have completed.
Answers:
• all
• each
• the predefined
• selected
64. Consider the following code snippet:

    var a = function(arg1) {console.log(arg1.toString());};
    var b = a.pass('a'); b();

What does this code snippet write into console?
Answers:
• a
• aa
• null
• This code snippet is invalid.
65. Fill in the blank with the correct word:

fireEvent function executes all events of the specified type present in the ___.
Answers:
• element
• window
• document
• object
66. Consider the following code snippet:

    var arr1 = {a1: 8, a2: 7};
    var arr2 = {a3: 6, a4: 5};
    var arr3 = {a1: 4, a3: 3};
    var arr4 = $merge(arr1, arr2, arr3);

Which of the following is the value of arr4?
Answers:
• {a1: 8, a2: 7, a3: 6, a4: 5, a1: 4, a3: 3}
• {a1: 4, a2: 7, a3: 3, a4: 5}
• {a2: 7, a3: 6}
• {}
67. What does Asset.image do?
Answers:
• Load the image, and insert it at the beginning of the document.
• Load the image, and insert it at the end of the document.
• Load the image, but do not insert into the document.
• Get the id of the image.
68. What does $('div'); return if there is no element with "div" id?
Answers:
• Elements that have class "div".
• null
• It causes an exception.
• All div elements.
69. What does $$('a', 'b'); return?
Answers:
• All anchor elements and bold elements.
• Element with id a and element with id b.
• Element with class a and element with class b.
• Element that has class a and class b.
70. Consider the following code snippet:

    var a = $arguments(1);
    alert(a('a','b','c'));
What does the alert box display?
Answers:
• a
• b
• c
• There is no alert box.
71. Consider the following code snippet:

    var a = ['1', '2', '3'];
    var b = 4;
    a.include(b);

What is the result of a?
Answers:
• ['1', '2', '3', 4]
• ['1', '2', '3', '4']
• [1, 2, 3, 4]
• This code snippet is invalid.
72. Which of the following classes can you use to create sortable elements?
Answers:
• Sortables
• Orderables
• Effects
• Movables
73. Which of the following methods can you use to apply a collection of styles to an element?
Answers:
• setStyle
• setStyles
• applyStyle
• applyStyles
74. Which of the following functions stops propagation from child element to its parents?
Answers:
• preventDefault
• stopPropagation
• preventPropagation
• stopDefault