Examination Questions
Note: The competency table is written in such a way as to make it easy to construct additional examination questions.
JavaScript History and ECMAScript characteristics
- Explain how the terms ECMAScript, JavaScript, ActionsScript and JScript relate to each other.
- What languages have influenced JavaScript? How?
- What is the Document Object Model (DOM)?
- Explain the terms DHTML, DOM scripting and Ajax.
- List three implementations of ECMAScript outside of web browsers.
- What is the difference between an interpreted and a compiled programming language?
DOM Scripting best practices (overview)
- Summarize the concepts of “graceful degradation”, “progressive enhancement” and “unobtrusive scripting”.
- What characterizes well written JavaScript?
ECMAScript lexical structure
- In programming, what is a statement?
- What terminates a statement in JavaScript?
- To what family of programming languages does JavaScript belong, looking at how to construct compound statements?
- Write out an XHTML comment? A JavaScript comment in two ways?
- Give an example of o common error caused by JavaScript being case-sensitive.
ECMAScript data types and variables
- List and define the data types available in JavaScript?
- Define the term “variable” as it relates to JavaScript.
- Explain the rules of identifiers in JavaScript.
- What is weak typing?
- How does JavaScript do boolean conversions?
- Explain why "1" + 1 == 11
- Why is 1 == "1" but not 2 === "2"?
- What variable scopes are available in JavaScript?
- Which versions of JavaScript have got block scope? What is it and how do you use it?
- Summarize the concept of garbage collection
Expressions and Operators
- What are JavaScript operators and how are they used?
- Explain arity.
- Explain how operator associativity and priority work in ECMAScript.
- Write an if-else statement and make a ternary operator expression with identical functionality.
- What is the difference between assignment by value and assignment by reference? When does the latter occur in JavaScript?
- What does the operators typeof and instanceof do?
- Why is it troublesome to typecheck an array with typeof?
- Construct an expression using post- and pre- incrementation.
Control Structures
- Define the purpose of the var keyword.
- Define the purpose of a conditional statement.
- Define the purpose of a repeat loop.
- What are exceptions? How do one throw and catch exceptions?
Strings and String Functions
- How does javaScript internally represent strings?
- What is concatenation?
Objects and Arrays
- In JavaScript, what is an object? An array?
- What are Array and Object literals?
- Explain the difference between dot notation and bracket notation.
- Being classless, how does JavaScript support inheritence?
- What array-like (i.e. similar to but not being true arrays) objects does ECMAScript and the DOM have?
Functions
- What is a function?
- What does the return statement do?
- What is lambda?
- In JavaScript functions are first class objects; explain.
- What is a parameter or “argument” and how is it related to a function?
- What is the arguments property of a function? How can it be used?
- What is a closure?
Regular expressions
- Explain regular expressions.
The Date Object
- Briefly explain the usage of the Date object
Numbers and the Math object
- What is a Number in JavaScript?
- Does javaScript differentiate between integer and decimal data types?
- How can a value be converted to a number?
- How can a value be checked to see if it is a number?
- How can a number be rounded to a given precision?
- What is the purpose of the Math object?
Programming concepts
- What programming paradigms can be supported by JavaScript?
- Explain iteration, enumeration and recursion.
- JavaScript usually does not have standard streams, but a global object; explain.
- What are the naming conventions regarding constructor objects in JavaScript?
- What is a Run Time Environment?
- Explain the concept of namespaces and demonstrate some ways of working around the lack of namespaces in ECMAScript 3 and 5th edition
Client side DOM Scripting/Properties and methods of the window Object
- How can one add scripts to an (X)HTML page? Give several examples and discuss their benefits and what ways should be avoided?
- What is the window object.
- List at least 5 commonly used properties or methods of the window object.
- Write a few lines of realistic client side JavaScript and explain what parts are ECMAScript and what parts are the DOM.
- List all major standards that apply to the DOM and the BOM and briefly state what is covered by each standard.
The Document Object Model
- Construct a simple (X)HTML document and graph out the equivalent DOM structure.
- What is a node? What types of nodes are there?
- Define childNodes, firstChild, and lastChild properties.
- What is PCDATA and CDATA?
- What is the Document Element?
DOM Support
- What is capability testing? Why is it important? How is it superior to browser sniffing?
- Write a line of DOM Script that demonstrates how to capability test.
Accessing DOM Elements
- Show how to access elements in the DOM in at least five different ways.
- Compare setting and getting attributes, using DOM Core methods as well as DOM HTML methods.
- What are “collections” in the DOM?
DOM and Class and Style Manipulation
- Why should the document.write() method be avoided?
- When using innerHTML in a pure XHTML page, what limitations apply?
- How can one access the text content of an element?
Manipulating the DOM
- How are elements constructed an added to the DOM using DOM Core methods?
- List and briefly explain at least three good practices to get fast script execution when manipulating the DOM or changing styles dynamically.
- HTML 5 adds a new special attribute intended for storing arbitrary data; what are those attributes and how can they be accessed?
Libraries
- What are the leading DOM Scripting libraries? In a sentence or two descibe their design principles.
Events
- What are DOM 0 event handlers?
- What are DOM 2 event listeners? What benefits do they have compared to event handlers?
- Internet Explorer up to and (at least) including 8.0 does not support W3C events; what does it have instead?
- Explain event capturing/bubbling.
- Some events are troublesome due to cross browser inconsistencies and bugs. Give an example and explain ways of working around it.
- Explain at least three ways of making sure the DOM is loaded before code is executed.
Timed events
- The window object has four methods that apply to timed events, what are they and how do you use them?
Form handling
- List the most commonly used form events (at least 3).
- Explain how to access the value of a radio button based field in a form.
Ajax
- What is Ajax?
- List some common usability problems caused by badly written Ajax scripts (at least 3).
Accessibility
- What kind of disabilities or technological limitations must a developer of a web site take into consideration?
- What is ARIA? How can ARIA be used to facilitate accessibility on scripted pages?
Common DHTML mistakes and security
- DHTML of the 90's gave JavaScript a bad reputation. List some common mistakes that contributed to this fact.
- What is Cross Site Scripting?
- JavaScript guru Douglas Crockford warns against “hidden uses of eval”; explain.