Elance Dojo Test Answers 2015

What is Dijit?
Dijit is Dojo's AMD loader.
Dijit is Dojo’s UI Library.
Dijit is Dojo's math library.
Dijit is Dojo's git interface.
Dijit is Dojo's interface to the jQuery effects functions.

How do you use dojo/query to get all elements with class "foo"?

What is a dijit?
A framework
A type
An object
A widget

Which code loads the dijit/form/Button module and waits until HTML has been loaded and processed?
(none of these)
(dojo/domReady!).wait(["dijit/form/Button"], function(Button) { // Do something });
require(["dijit/form/Button", "dojo/domReady!"], function(Button) { // Do something });
try { dojo/DomReady!(); } catch (e) { load "dijit/form/Button"; }
when.DomReady.use ("dijit/form/Button", function(btn){ // Do something });

What does dojo DojoX handle?
Foundation elements of Dojo
The Dijit widgets
Extensions and experimental code from the Dojo team and third party
Deprecated code

What are the two ways to add Dijit widgets?
none of these
programmatically and declaratively
inline and included
with style tags
using PHP

What does Dojo Dijit provide?
UI widgets
XHR, AJAX, inheritance, packaging, query, etc
Extensions from Dojo team and third party
Internationalization, accessing data stores, effects, back-button handling, etc

What does dom.byId() return?
Reference to the document
Reference to the dijit
Reference to the DOM element
An event handler

How do you load Dojo on your HTML page?
Include _base.js
Include dojo.js
Include main.js
Include html.js

What is JSON?
JavaScript Optimized Node
JavaScript Optimal Notation
JavaScript Original Notation
JavaScript Object Notation
JavaScript Origin Node

When should you use a built version of Dojo?
A built version of Dojo eliminates the need for public and private caching, speeding delivery with redundant requests.
The Dojo build process should only be used for mobile device applications.
A built version of Dojo should be used when you need to minimize the amount of code downloaded and the number of requests made.
There is no build system for Dojo. The advantages of AMD eliminate the need for builds.
You should never use a built version of Dojo.

What are the main packages of Dojo?
Firefox, IE, Chrome, and Safari
Dojo, Dijit, DojoX, and util
AMD, Ajax, fX, and GUI
desktop, tablet, and mobile
layout, design, font, and effects

What does the dojo/_base/declare module contain?
dojo/_base/declare creates the site infrastructure and language encoding.
dojo/_base/declare contains functions to define Dojo classes, which support standard Object Oriented concepts within Dojo.
dojo/_base/declare contains JSON extensions to allow cross-domain request completion.
All of these.
dojo/_base/declare is used to explicitly declare variables for high precision computations.

What does Dojo Util provide?
Dojo Util contains utility scripts including build, shrink, test and documentation support
Internationalization, accessing data stores, effects, back-button handling, etc
Utilities specific to widgets
XHR, AJAX, inheritance, packaging, query, etc

What server-side technology can Dojo work with?
Dojo works only with Microsoft technology and performs best with Internet Explorer, version 6.0 and earlier.
Dojo works only with PHP and Java. Other languages integrations are being developed and expect to be deployed by the end of 2013.
Dojo is a client-side, back-end agnostic technology that can be used in conjunction with ANY server-side technology.
The Java in JavaScript means that Dojo only works with Java code, on both the client and server-side.
Dojo does not work with ANY server side technology. Web applications that use Dojo must load ALL data and content prior to execution because once the page is loaded additional requests are impossible.

What is dojo/store?
dojo/store is an uniform interface for the access and manipulation of stored data.
dojo/store captures screen shots to support debugging and cross-browser testing.
dojo/store is used for ecommerce applications because it provides encryption within the front-end for security.
dojo/store is used to buffer keystrokes and mouse events to allow synchronous processing.
dojo/store is used only on the Konquerer browser as a shim.

lang.replace("title/{home}/{page}", {home: "dojo", page:""}) produces what result?

How do you import a module? (in this case dojo/query)
define([dojo/query], {});
require([dojo/query], {});
require(["dojo/query"], {});
define(["dojo/query"], {});

To create a Dijit button widget, what module must be used?

When does the function in require(["dojo/domReady!"], function() {}); execute?
When the DOM has finished loading
After Dojo has loaded but before the DOM is ready
dojo/domReady! is not a valid Dojo module
It will give an error since domReady was not passed in as a parameter

What does dojo/hash provide?
Interface to advanced data structures
A hash table
An object to store data
Interface to the browser's URL hash

In this code: require(["dojo/request"], function(request){ request("example.json", { handleAs: "json"}).then(function(data){ // Do something }) }); data is
Inserted prior to the request.
The string "example.json".
The HTTP status code for the request.
The content of the file example.json.

DojoX is
The next generation of Dojo, it is available for testing as a beta distribution.
DojoX is an area for development of extensions to the Dojo toolkit.
An optimized version of Dojo for production sites which require extremely fast code.
Cross-platform support for embedded devices.
Deprecated functions which are retained for backwards compatibility.

What is one way to add a click handler to a button?
button.on.click = function(e){ // handle event });
call(button, "click", function(e) { // handle event });
on(button, "click", function(e){ // handle event });
function on(button, "click") { // handle event }

The annotation data-dojo-attach-point='foo' allows us to do what?
Position the DOM node on the page
Prevent the DOM node from being changed
Allow access to the DOM node by the widget
Allow the annotated DOM to be editable

What function handles the call back feature?

Which module provides enhancements to native Array functions which may not be available?
Dojo does not provide enhancements for array functions

To create a table with an Ajax interface to a server, you can use
dijit/form/Grid or dijit/form/Table
data/table/Grid or data/table/Ajax/Grid
dojox/grid/DataGrid or dgrid

When we create dijits programatically rather than declaratively we must ensure to?
Call constructor()
Call startup()
Call postCreate()
Call inherit()

What does registry.byId() return?
Reference to the dijit
Reference to the element
Reference to the tag
Reference to the document

How is JSON-P different than JSON?
JSON-P works by making a <script> element (either in HTML markup or inserted into the DOM via JavaScript), which requests to a remote data service location.
JSON-P is delivered by servers which use PHP, Perl or Python due to the technology integration with Apache.
JSON-P uses the UTF-8P character set which extends the data range of the encoding to transmit more information faster.
JSON-P is a white-space padded version of JSON which is easier for both machines and people to read.
There is no difference.

dojo/on is
used to load Dojo
a general-purpose event handler module
used to enable Dojo
a jQuery feature which allows you to call dojo modules
bundled with dojo/off

What does lang.getObject("foo.bar") return?
The translation of foo.bar into the current locale
The normalized string "foo.bar"
The bar property of foo
Value of bar nested in foo

AMD is an acronym for
Asynchronous Module Dojo
Ajax Multiple Definition
Asynchronous Multiple Deferred
Ajax Modules Dojo
Asynchronous Module Definition

Which Dijit widget should be used to validate a telephone number? In this case a telephone number is defined as a string up to 16 characters, including digits, parentheses, dashes, periods, spaces and an upper or lower case x.

What does dojo/has do?
Check the browser version
Check the browser type
Check if Dojo is already loaded
Check if the browser supports a feature

How does a function and it's call back behave?
Run the call back before you run the code
Run the function and the call back asynchronously
Run the function then run the call back once we enter the function
Run the function then invoke the call back

What do compliant async functions return?
an event
JavaScript object
JavaScript function
Defered object

Why should you place the script tag that loads Dojo at the end of the document body?
Because most pages have some HTML elements which must be ready for use before Dojo can run.
None of these answers.
Browsers process script tags in the document body using a faster algorithm than those in the head section.
Because Dojo tests to see where the tag used to load it from is located and will fail to execute otherwise.
The script tag should always be in the page header.

What does setting parseOnLoad to true do?
Apply dojo/parse selectively to certain DOM elements after the page is loaded
Apply dojo/parser to the entire body after the page is loaded
Skip parsing as the user will parse selectively after the age is loaded
Enable dojo to be used after the page is loaded

What is dojo/domReady! ?
dojo/domReady! provides an audible beep which alerts the user the page is ready for use.
dojo/domReady! is a documentation convention used to remind coders to include a timeout to ensure the DOM is ready prior to execution.
dojo/domReady! parses the DOM, applying the Dijit widget code to the HTML, which readies the page for use.
dojo/domReady! is an AMD loaded plugin that will wait until the DOM has finished loading before returning.
dojo/domReady! loads the DOM into Dojo and fires the pageFullyLoaded event.

What does lang.hitch() do?
Call a function in the context of a widget
Concatenate two JSON objects together
Bind a function to the widget
Concatenate two strings together

What do dijits not offer?
Extensible UI controls
Accessing data stores
Using preexisting dijits

How do you bind a function to response to UI events?

Is there a CDN for Dojo?
Dojo is bundled with the _Mojo_ library on all major CDNs.
Dojo is distributed on CDs which must be purchased. N refers to the version.
No, you must install Dojo on your server.
You should never use a CDN with a JavaScript library.

How do I query a store using complex criteria (month > 10)?
dates.query({month: "11"}) + dates.query({month: "12"})
dates.query({month > 10});
dates.query(function(date){return date.getMonth() > 10});
dates.query({month: "10"}) + dates.query({month: "11"}) + dates.query({month: "12"})

What is the _WidgetBase lifecycle?
constructor > startup > postscript
constructor > startup
constructor > postscript > startup

How do we access a dijit's properties?
Extension points provided by the dijit
Server-side code
Accessing the dijit's DOM
Creating a new dijit and removing the old one

What is dojo/when used for?
Handling both async and synchronous code
Handling async code but not synchronous code
Handlling synchronous code but not async code
Binding functions to dijits

How do we define an internationalisation nls file? (denoted NLSFILE)
define(["dojo/i18n/NLSFILE"], funtion(nlsFile){});
define(["dojo/i18n!NLSFILE"], funtion(nlsFile){});
define(["dojo/i18n./NLSFILE"], funtion(nlsFile){});
define(["dojo/i18n/!NLSFILE"], funtion(nlsFile){});

When invoking lang.mixin(y, x) what happens?
Sources are processed to return all properties that are both in x and y (with y's properties 'winning')
Sources are processed left to right so all of x is added to y (with y's properties 'winning')
Sources are processed to return all properties that are not both in x and y
Sources are processed right to left so all of y is added to x (with x's properties 'winning')

What does AMD provide?
Each module not specifying its dependencies
Each module specifying its dependencies
Globally loaded dependencies
Linear loading of dependencies that takes into account dependencies that are already loaded

Which Dojo module is used to make Ajax requests?

What is the difference between a dijit/form/FilteringSelect and a dijit/form/ComboBox?
There is absolutely no difference, the ComboBox has been retained for backwards compatibility.
ComboBoxes are used to enter passwords because they are more secure.
The FilteringSelect allows you to enter a new option, one that is not listed.
The ComboBox allows you to enter a new option, one that is not listed.

How should Dijit widgets be styled?
Dijit widget styling is static, you can not change the way widgets look.
Dijit widgets must be styled with a DojoX Theme.
Image overlays are used to apply Dijit widget styling. Every widget needs an image overlay to ensure consistent display.
Element specific style attributes should be placed on the tag or in the instantiation code for every Dijit widget.
Dijit widgets should be styled using a Dijit Theme.

The build process compiles the Dojo JavaScript into Java for distribution.