Dojo Interview Preparation Guide
Download PDF

Dojo frequently Asked Questions in various Dojo job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting

33 Dojo Questions and Answers:

1 :: What is the difference between dojox, mobile, parser and dojo.parser?

Some of the advanced features of dojo.parser, such as <script type=”dojo/method”> and <script type=”dojo/connect”>, are missing. Basic features are compatible with dojo.parser.

2 :: Can we have to use dojox/mobile/parser for Dojo Mobile applications?

No, we don’t have to. dojox/mobile/parser is a subset of dojo.parser. Usage and how it works are basically the same. It has no mobile specific features. dojox/mobile/parser’s ONLY advantage over dojo.parser is its smaller code size. If your application unfortunately does not work with dojox/mobile/parser, you can replace it with dojo.parser. Also if you are embeding your mobile application in an hybrid container such as Cordova, the size might not matter that much and you might prefer to pick the full parser.

3 :: Are applications using Dojo Mobile accessible?

Some Dojo Mobile widgets are not accessible. For example, the ScrollableView can only be scrolled by using touch gestures. You must develop alternative ways, ex. buttons for scrolling, to ensure accessibility. Other examples requiring alternatives are SwapView flip and ListItems editing.

4 :: Tell me can we change the widget text size by changing the browser text size?

No, we suggest that you use the page zoom function available on some browsers for this purpose.

5 :: How to develop applications which support iOS VoiceOver?

Make sure to set the alt, title and role attributes. VoiceOver will read widgets with these attributes set. See tests/test_a11y.html for examples. However, the value of a SpinWheel can not be read by VoiceOver in 1.8.

6 :: Tell me can you set the tab focus sequence for destop browsers?

Yes, use the tabindex attribute for this purpose. IconItem, IconMenuItem, ListItem, TabBarButton and ToolBarButton all have the tabindex attribute initially set to 0 by default.

7 :: Do you know why does <body> in many of tests html files have style=”visibility:hidden;”?

It is to prevent raw HTML rendering result from being shown before dojo’s rendering finishes. The visibility will be restored by the initialization code in dojox/mobile/common.

8 :: How to use dojox/mobile/deviceTheme?

Dojo 1.8 brings improvements that allow to safely load the deviceTheme with a script tag, and for overriding the theme styles.

9 :: Explain dojo/ready module functions?

The dojo/ready module provides a function that registers a callback that will run once three conditions have met:

The DOM is ready
All outstanding modules of requested code have completed loading
Other registered functions with a higher priority have completed.

10 :: What is Dojo?

Dojo is actually based on JavaScript and HTML, so its easy to learn. You can learn Dojo very fast and start developing your next highly interactive web applications.
• Dojo is the Open Source JavaScript Toolkit
• It is tool for constructing dynamic web user interfaces
• Dojo offers widgets, utilities, higher IO (AJAX) abstraction etc.
• BSD or AFL licensed

11 :: What is the basic structure in Dojo?

The basic directory structure of the application is very simple and it will evolve later:
/index.html - The application entry point.
/app - The application module.
/app/main.js - The main script for app module.

12 :: What is the point in Dojo?

• Dojo bases on the HTML and JavaScript
• Developer has not to use any strange programming language
• Dojo ups abstraction layer in a higher level
• Developer has not to reinvent wheel when starting programming project

13 :: Explain History of Dojo?

• Development was started by Alex Russell and Dylan Schiemann in 2004
• The first Dojo code was written in Septemper 2004
• Nowadays 40 000 downloads and over 40 developers and companies

14 :: What is Package System in Dojo?

• Dojo consists of JavaScript files
• Package system takes care that only needed files are included
• Each JavaScript file can be named as package dojo.provide(dojo.string)
• By that name the package can be taken in use dojo.require(dojo.string)
• One has not to remember any file or directory names
• Only dojo.js has to be included into HTML document
• That file takes care of initialization of Dojo
• There is a couple of pre packaged builds that consist of different kinds of packages e.g. Widget, event or IO builds.

15 :: What are the advantages or benefits of Dojo?

Associative arrays
Loosely typed variables
Regular expressions
Objects and classes
Highly evolved date, math, and string libraries
W3C DOM support in the Dojo

16 :: Sample example on Dojo?

First you can download the dojo required files from the below link:

Example of Creating a Button

Here we are going to create a button "Hello World!". To create a button in dojo you need to a Button Widget that contains three visual states as: mouseOut, mouseOver and mouseDown. To follow the following steps for creating a dojo button widget:

<script type="text/javascript">
// Load Dojo's code relating to widget managing functions

// Load Dojo's code relating to the Button widget

dojo.require("dojo.widget.*"): It instructs you to include the dojo widget (Not load all the widgets) for managing functions.

dojo.require ("dojo.widget.Button"): This line instructs you to load the Dojo button widget. If you don't include this line, the markup code for the button would not be evaluated by Dojo upon loading, resulting in a plain HTML button instead of what you expect.

Insert the following code into the HTML body:

<button dojoType="Button" widgetId="helloDojoButton"
onClick="helloPressed();">Hello World!</button>

The key attribute of this HTML element to notice is the dojoType attribute. This is responsible for instructing Dojo on how to process the element when the page is loading. In this case you will use a button element for the button that is used to input element - Dojo will work with either as long as the dojoType attribute is present.

widgetId="helloDojoButton": This is replaced with id="helloDojoButton" without the functionality being affected - Dojo's widget system is smart enough to convert regular idattributes to widgetId's if no widgetId` attribute is explicitly named.

Connecting an Event to the Widget

When you click the command button then it doing something? We specify an onClick event handler for the given command button.


Above code we use "dojo.event.*" that includes all events functionality of Dojo (But not all widgets).

Following function that will called by the button when we clicked. After clicking the "helloPressed" method is called and it displays an alert message like: "Click on the Hello World Button".

function helloPressed()
alert('Click on the Hello World Button');

17 :: Explain Sample code for Checkbox in Dojo framework?

Check boxes are the same as html but dojo provides more controls and styling options than a conventional check box. The checkbox contains Boolean types value either 'true' or 'false'. The following example creates a Checkbox:
<!-- check box -->
<script type="text/javascript">

<h2>Check box</h2>
<input id="cb" dojotype="dijit.form.CheckBox" name="developer"
checked="checked" value="on" type="checkbox" />
<label for="cb"> Are you a Dojo Developer </label>

18 :: Example of Radio Button in Dojo framework?

Radio Buttons are the same as html but dojo provides more controls and styling options than a conventional Radio button. The radio button also contains Boolean types value either 'true' or 'false'. The following example creates a Radio buttons:
<!-- radio -->
<script type="text/javascript">

<h2>Radio button</h2>
<input dojoType="dijit.form.RadioButton" id="val1" name="group1"
checked="checked" value="Programmer" type="radio" />
<label for="val1"> Programmer </label>
<input dojotype="dijit.form.RadioButton" id="val2" name="group1"
value="Designer" type="radio" />
<label for="val2"> Designer </label>
<input dojotype="dijit.form.RadioButton" id="val3" name="group1"
value="Developer" type="radio" />
<label for="val3"> Developer </label>

19 :: Example of Tree in Dojo Framework?

The tree is a GUI that helps to lists the hierarchical lists. The tree widget is a simple but the real power comes in the data. It represents the hierarchical structure of tree. Data is fed by the powerful dojo.dataAPI.

There are following steps for creating Dojo trees :

Create a rooted or rootless trees (forests)
Nest, each branch is independently expandible
Different icons for different leaf or branch classes
Tree data are stored in any implementing API.
Events fire when users clicked on it.
Add, remove or disable nodes of tree.


<style type="text/css">
@import "../resources/dojo.css";
@import "../dijit/themes/tundra/tundra.css";

<script type="text/javascript" src="dojo.xd.js"
djConfig="parseOnLoad: true"></script>


<body class="tundra">
Simple Tree:
<div dojoType=""
url="tree.txt" jsid="popStore" />
<div dojoType="dijit.Tree" store="popStore"
labelAttr="sname" label="Tree"></div>

tree.txt file contains:
{ label: 'name',
identifier: 'name',
items: [
{ name:'Students', type:'cat',
children: [
{ name:'Vinod', type:'st' },
{ name:'Suman', type:'st' },
{ name:'Deepak', type:'st' }

20 :: What is Widget Toolkit in Dojo?

• Widget toolkit is also a very noticeable part of Dojo toolkit
• Widget is a user interface object that has a layout and some properties
• In Dojo widgets are HTML+CSS bound by JavaScript
• Dojo has lots of useful widgets e.g. Tabs, sorting table, dialogs