Vous êtes sur la page 1sur 13

1.

How do you submit a form in JavaScript?


A) document.forms[0].submit();
B) document.forms[0].submit(true);
C) document.forms[0].submitForm();
D) document.forms[0].submitAll();
2.
When is the following statement true? if (day = "26")
A) When the variable age equals 26
B) This statement is never true
C) This statement is always true
D) If it is the twenty sixth day of the month
3.
Which of the following is not the job of the window
object?
A) Client side global object - Contains all the
variables and functions defined in your scripts
B) Represents the browser window
C) Provides a way to access the clients machine
information
D) Other miscellaneous information and functionality -
location, history, interaction methods such as alert,
prompt, etc., and agent information
4.
In the MS IE event model:
A) event object is sent to the event handling function as
its first argument.
B) event object is always window.event.
C) both a and b.
D) none of the above.

5.
Radio buttons are different than checkboxes such that
you:
A) need to go through an entire array to see which one of
them is checked.
B) you don't need to go through an entire array to
see which one of them is checked.
C) they are not different at all.
D) none of the above.
6.
The following are literals you can write in JavaScript
except:
A) string.
B) floating-point.
C) integer.
D) DateTime.
7.
In order to avoid any caching on the server for GET
specific AJAX requests, which of the following tactic can
be used?
A) Append a datetime stamp to the URL
B) Append a random number to the URL
C) Append a unique GUID to the URL
D) All of the above
8.
alert() is a method of which object in JavaScript?
A) Window
B) Document
C) Navigator
D) None of the above
9.
The try/catch/finally statement allows you to test a block
of code for errors. Which of the following statements is
true about this construct?
A) The finally clause is optional and if present must
always be executed
B) The finally clause is mandatory and if present must
always be executed
C) There are some serious browser compatibility issues
with this construct
D) Some errors are not caught by the browser
10.
All the technologies are part of the AJAX technology stack
which are required, except:
A) XMLHTTP/XMLHttpObject.
B) HTTP/S.
C) JavaScript.
D) XML.
11.
What is the maximum number of cookies that can be set
by a single website?
A) 2
B) 8
C) 16
D) 20
12.
The status property of the XMLHttpObject gives the
numeric code returned by server for the AJAX request.
Which level of codes indicates success?
A) 100 level
B) 200 level
C) 400 level
D) 500 level
13.
The browser makes an Ajax call by calling the:
A) send method of the XMLHttpObject.
B) sendRequest method of the XMLHttpObject.
C) sendAJAXRequest method of the XMLHttpObject.

D) sendData method of the XMLHttpObject.


14.
Browser detection does not work because:
A) browsers lie about who they are.
B) you may filter out browsers that support your code or
fail to filter out browsers that don't support your code.
C) browser detection isn't future proof: can't future proof
your code against new browsers.
D) all of the above.
15.
The eval() method is incredibly powerful because it:
A) allows you to execute snippets of code during
execution.
B) allows you to evaluate for enough resources.
C) allows you to evaluate and validate user input.
D) all of the above.
16.
The following events are defined on the input checkbox,
except:
A) onblur.
B) onfocus.
C) onselect.
D) onclick.
17.
How do you assign an object's property in JavaScript?
A) obj("age") = 30;
B) obj.age = 30;
C) Both a and b above
D) None of the above
18.
How do you close a browser window with HTML code?
A) self.close()
B) window.close()
C) Both a and b above
D) None of the above
19.
How do you create an object in JavaScript?
A) A constructor function
B) Using object literals
C) Using the Object() object
D) All of the above
20.
JavaScript provides a special for loop to iterate over
associative arrays members or object properties, which of
the following is that form:
A) for(var i at myObjectOrAssociativeArray) {… }
B) for(var i in myObjectOrAssociativeArray) { …}
C) for(var i of myObjectOrAssociativeArray) { …}
D) all of the above
21.
How do you determine the state of a checkbox using
JavaScript?
A) var IsChecked =
document.getElementById("myCheckBox").checked
;
B) var IsChecked =
document.getElementById("myCheckBox").IsChecked();
C) var IsChecked =
document.getElementById("myCheckBox").checkedState;

D) var IsChecked =
document.getElementById("myCheckBox").GetCheckedSt
ate();
22.
How do you locate the first X in a string txt?
A) txt.find('X');
B) txt.locate('X');
C) txt.indexOf('X');
D) txt.countTo('X');
23.
How do you disable an HTML object?
A)
document.getElementById("myObject").DoDisable(true);
B) document.getElementById("myObject").disabled
= true;
C)
document.getElementById("myObject").DisableIfPossible(
true);
D) It is browser dependent
24.
In order to read the current sytle of an element,
window.getComputedStyle(element,
null).stylePropertyName can be used:
A) in MS IE.
B) in Mozilla based browsers.
C) both a and b.
D) none of the above.
25.
How do you find the client's browser name?
A) client.navName
B) navigator.userAgent
C) browser.name
D) userAgent.name
26.
In JavaScript, all the following can be used as expressions
except:
A) a variable.
B) a function that returns a value.
C) an Object.
D) variables, functions, and literals combined using
operators.
27.
How do you hide JavaScript code from old browsers that
don't support it?
A) Use HTML comments within (script) tag
B) Use (NOSCRIPT) Tag
C) None of the above
28.
How many times will the following loop print the word
loop to the screen? var index = 0; while (index < 3)
{ window.document.writeln("loop"); index++; }
A) 1
B) 2
C) 3
D) 4
29.
If you try to multiply a string with a number:
A) you'll get an error.
B) you'll get a NaN back.
C) you'll get 0 back.
D) you'll get the string back.
30.
In a pop-up browser window, how do you refer to the
main browser window that opened it?
A) window.parent
B) window.creator
C) window.opener
D) It depends on the browser
31.
In the MS IE-style event registration model, we use this
method.
A) attachEvent()
B) addEventListener()
C) registerEvent()
D) attachEventListener()
32.
Keeping browser incompatibilities aside, an event can be
registered except:
A) (input type="button" id="btn" name="btn"
value="Click" onclick="handler()" /)
B) document.getElementById("btn").onclick =
function() { alert("handler!"); }
C)
document.getElementById("btn").addEventListener("oncli
ck", handler, false);
D)
document.getElementById("btn").addEventListener("click
", handler, false);
33.
nodeList is almost like an array except:
A) it has an item method.
B) it is read-only.
C) both a and b above.
D) none of the above.
34.
One way to check if cookies are enabled is to:
A) set it and read it back.
B) see if document.cookie is not null.
C) you cannot disable cookies.
D) query the browser api.
35.
The break statement:
A) is used to break out of a loop.
B) is used to break out of a switch statement.
C) both a and b above.
D) none of the above.
36.
The continue statement:
A) is used to skip over the switch cases.
B) is used to skip over one iteration of the loop.
C) both a and b above.
D) none of the above.
37.
The join() function allows you to:
A) create a string out of an array.
B) create an array out of a string delimited by some
character.
C) join two strings.
D) all of the above.
38.
To change the presentation of an element, which of the
following can be used?
A)
document.getElementById('elem1').style.propertyName =
"value";
B) document.getElementById('elem1).className =
"value";
C) Both a and b above
D) None of the above
39.
What is the correct syntax for referring to an external
script called "include.js"?
A) (script src="include.js" /)
B) (script href="http://include.js" /)
C) (script name="include.js" /)
D) All of the above
40.
What is the result of the expression 2+5+"8" in
JavaScript?
A) 15
B) 78
C) 213
D) 258
41.
Which construct is used if you want to select one of many
blocks of code to be executed?
A) if...else if....else statement
B) if...elseif....else statement
C) if...elsif....else statement
D) if...else....else statement
42.
Which DOM property is used to set a document's
background color?
A) document.bgColor
B) document.backgroundColor
C) document.color
D) It depends on the browser
43.
Which event is triggered when the contents of a text
element is changed?
A) onBlur
B) onChange
C) onTextChange
D) onKeyDown
44.
Which of the following is not a standard?
A) Document Object Model
B) Browser Object Model
C) ECMAScript
D) HTML
45.
Which of the following statements would be used in code
to work like a browser's back button?
A) history.go(-1);
B) history.back(1);
C) history.back(-1);
D) history.forward(-1);
46.
Which of the following is not a property of the window
object?
A) screenX
B) scrollbars
C) toolbar
D) windowX
47.
Which of the following is true statement about the return
statement in JavaScript?
A) It causes the function to exit
B) It passes a value back to the line of code that
called it
C) Both a and b above
D) None of the above
48.
Which of the following is a true statement about nested
functions in JavaScript?
A) You can only call a nested function locally
B) The nested function has access to all the local
variables of its parent function
C) There can be some serious scope issues
D) All of the above
49.
Which would JavaScript assign to an un-initialized
variable?
A) NaN
B) false
C) null
D) undefined
50.
You can convert a string to a number in JavaScript using
all the following methods except:
A) parseFloat(string)
B) parseInt(string)
C) parseInteger(string

Vous aimerez peut-être aussi