The questions in this JavaScript quiz are on the topics covered in the JavaScript Advanced section of the site. The table below lists the
lessons, a description of the lesson content and the the quiz question number range.
Lesson Summary
Click on a lesson in the table to go to that lesson for a refresher on the topics for that lesson.
JavaScript Quiz
The quiz below tests your knowledge of the material learnt in the JavaScript Advanced section of the site.
Question 1 : In a switch....case....default
construct where do we put the expression we are going to evaluate?
- The <code>switch</code> statement is where we put the expression we are going to evaluate. .
Question 2 : The default
statement is mandatory when coding the switch....case....default
construct?
- The <code>default</code> statement is optional when coding the <code>switch....case....default</code> construct.
Question 3 : Which construct is the Conditional
special operator often used as a shortcut replacement for?
- The <code>Conditional</code> special operator takes three operands and is often used as a shortcut replacement for the <code>if....else</code> construct.
Question 4 : What is alerted from the following code?
var aBoolean = 'true';
alert((aBoolean == 'false' ? 'A' : 'B'));
- <code>B</code> is alerted from the above code.
Question 5 : Which construct do we use with errors?
- We use the <code>try....catch....finally</code> construct when dealing with errors.
Question 6 : Will a finally
statement always run?
- A <code>finally</code> statement will always be executed.
Question 7 : How many global error constructors are there in JavaScript?
- There are 5 global error constructors, these being <code>Error</code>, <code>RangeError</code>, <code>ReferenceError</code>, <code>TypeError</code> and <code>URIError</code>, .
Question 8 : Which statement do we use to invoke an error?
- We use the <code>throw</code> statement to invoke an error.
Question 9 : The Number
object is static just like the Math
object and so we can't create objects of this type?
- The <code>Number</code> object is used for mathemitcal calcualtions much like the <code>Math</code> object is, but is not static and so we can create instances of the <code>Number</code> object.
Question 10 : When creating a Number
object, what do passed values that can't be converted return?
- When creating a <code>Number</code> object passed values that can't be converted return <code>NaN</code>.
Question 11 : What is alerted from the following code?
var aNumber = 12;
var bNumber = '12';
alert(aNumber + bNumber);
alert(aNumber + Number(bNumber));
- The first alert is treated as a string concatenation and so returns 1212. In the second alert we use the <code>Number</code> object for type conversion and so the numbers are added together and 24 is alerted.
Question 12 : How do we access properties of the Math
object?
- As the <code>Math</code> object is static we access properties of the <code>Math</code> class at the 'class level', therefore all properties are accessed using the following syntax <code>Math.aPropertyName</code>.
Question 13 : What are the Math
object properties examples of?
- The <code>Math</code> object properties are examples of JavaScript constants as their values never change. The way to recognize a constant is that any letters in its name should be in capital letters.
Question 14 : How many instance methods exist in the Math
class?
- The <code>Math</code> object is static and as such has no instance properties or methods.
Question 15 : What keyword can we use when creating objects to match a parameter to a property?
- We use the <code>this</code> special operator to match a parameter to a property.
Question 16 : What keyword is used in conjunction with this
for object prototyping?
- We use the <code>new</code> special operator in conjunction with the <code>this</code> special operator for object prototyping.
Question 17 : What does the acronym DOM stand for.?
- The acronym <em>DOM</em> stands for <em>Document Object Model</em>.
Question 18 : What are individual entries within the DOM known as?
- Individual entries within the <em>DOM</em> are known as <em>nodes</em>.
Question 19 : Web browsers provide which property that allows developers to modify the DOM?
- Web browsers provide the <code>innerHTML</code> property that allows developers to modify the <em>DOM</em>.
Question 20 : Which of the following is an event in JavaScript?
- Events are part of the <em>DOM</em> Event Model provided by all web browsers and are executed when a change happens on a web page, so all of the above are considered as <em>events</em>.
Question 21 : JavaScript is a multi-threaded language?
- JavaScript is not a multi-threaded language, so we don't have to worry about multiple events hitting a piece of code at the same time and possibly updating and corrupting shared data.
Question 22 : There are three ways to deal with events when using JavaScript, which one should we adopt in our event handling?
- With Listener Event Registration there is no pollution of structure and we can have multilple handles covering multiple events for the same element and so it the best way to deal with events.
Question 23 : Function recursion occurs when a function is referred to and called internally by itself. We can make a function refer to itself by using the function name or?
- The second way to use recursion is via an in-scope variable which refers to the function.
Question 24 : Each time a closure is called the local variables are reused?
- Each time a closure is called a new set of local variables are created.
Question 25 : A closures local variables are copied.?
- A closures local variables are stored by reference and not copied.
Question 26 : The encodeURI
global function encodes component parts of a uri?
- The <em>encodeURI</em> global function will encode special characters within the URL, apart from those parts used by component parts of the uri.
Question 27 : If we encode a URI using the encodeURIComponent
global function and then decode it using the decodeURIComponent
global function, we should end up with the same uri we had before we encoded and then decoded it.
- If we encode a URI using the <code>encodeURIComponent;</code> global function and then decode it using the <code>decodeURIComponent;</code> global function, we should end up with the same uri we had before we encoded and then decoded it.
Question 28 : What happens when we use the debugger
statement and no debugging functionality available.?
- The <code>debugger</code> statement starts up any available debugging functionality, or does nothing if no debugging functionality available.
Quiz Progress Bar Please select an answer
What's Next?
In the next quiz we test our knowledge of the topics covered in the jQuery Basics section of the site .
Homepage
Top