SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Javascript Basics
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. The string escape sequence to insert a double quote in JavaScript
Math.ceil(number)
event handler .
"
sensitive
2. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
document.getElementById("spanId").firstChild.nodeValue = "New Value";
prompt("Text Here")
getFullYear()
document.getElementById("radioButtonId").value;
3. To assign actions to the window onLoad event
document.getElementById("spanId").firstChild;
window.onload = function() {//actions here}
Two forward slashes "//"
Charset
4. To create a function that returns a value in JavaScript
document.getElementById("textAreaId").value = "Text Value";
v
document.getElementById("TextBoxId").focus;
var functionName = function(param1, param2, paramN) {}
5. To test that a variable contains a valid number
Math.max(var1, var2, varN)
toString(base)
isNaN(varHere) //Returns true or false.
document.getElementById("CheckboxId").checked = true; //Could also be false
6. The format to create a new Date object from a string
toFixed(digitCount)
document.getElementById("radioButtonId").checked = true; //Could also be false
Math.ceil(number)
var dateObject = new Date("11/22/2012 18:25:35")
7. Math object method used to return the square root of a given number
Math.sqrt(number)
Math.round(number)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
var dateVar = new Date()
8. To assign the value from a prompt to a string
v
udddd
var stringVar = prompt("Text Here")
Math.round(number)
9. To create an Array object in JavaScript
r
var arrayVar = new Array()
document.write("Text Here") //Remains on current line
<script type="text/javascript">.....</script>
10. To set the current value of the control for a text area
document.getElementById("textAreaId").value = "Text Value";
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
alert("Alert Text Here")
\
11. What String object method returns a new string containing the value of the original string but in all upper case
toDateString()
confirm()
window.location = "New Web Address Here";
toUpperCase()
12. To get the current value for textboxes
var dateObject = new Date("11/22/2012 18:25:35")
prompt("Text Here")
document.getElementById("TextBoxId").value;
var functionName = function(param1, param2, paramN) {}
13. To display a confirmation
focus
confirm("Message Text Here")
document.getElementById("TextBoxId").value;
toTimeString()
14. To create a function in JavaScript
Multi line
var functionName = function(param1, param2, paramN) {}
isNaN(varHere) //Returns true or false.
sensitive
15. To write a line to the current element of the DOM (Document Object Model)
substring(startIndex)
document.writeln("Text Here") //Advances to new line after text
udddd
'
16. To get the current checked status of the control for checkboxes
sensitive
var functionName = function(param1, param2, paramN) {}
document.getElementById("checkboxId").checked;
concat(var1, var2, varN)
17. The string escape sequence to insert a carriage return in JavaScript
===
r
expression
toFixed(digitCount)
18. When you add a string and a number the result will be a ____
document.getElementById("radioButtonId").value;
toExponential(digits)
toLowerCase()
string
19. The _____ attribute is used to denote external file for script use
toLowerCase()
Src - e.g. <script src="fileName.js"> //
document.getElementById("listId").value;
Math.floor(number)
20. Statements end in JavaScript with a ________
document.getElementById("listId").value;
toFixed(digits)
semicolon ";"
confirm()
21. To create a Date object in JavaScript
toLowerCase()
document.getElementById("CheckboxId").checked = true; //Could also be false
var dateVar = new Date()
f
22. To get the current value of the control for a text area
document.getElementById("textAreaId").value;
ondblclick
document.getElementById("spanId").firstChild;
<script type="text/javascript">.....</script>
23. String object method used to return the position of the first instance of a specified search string starting from the specified index
document.getElementById("listId").value;
sensitive
indexOf(searchValue, startPosition)
<script type="text/javascript">.....</script>
24. To set the current checked status of the control for radio buttons
document.getElementById("radioButtonId").checked = true; //Could also be false
expression
Math.sqrt(number)
Math.min(var1, var2, varN)
25. The string escape sequence to insert a tab in JavaScript
Math.abs(number)
t
isNaN(varHere) //Returns true or false.
toExponential(digits)
26. To get the current checked status of the control for radio buttons
document.getElementById("radioButtonId").checked;
window.onload = function() {//actions here}
f
var functionName = function(param1, param2, paramN) {}
27. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
toUpperCase()
window.location()
Underscores
!==
28. Math object method used to return the lowest value for a set of supplied numbers
document.getElementById(id)
Math.min(var1, var2, varN)
Math.ceil(number)
toFixed(digits)
29. What Date object method is used to return the number of milliseconds since the start of GMT
getTime()
document.write("Text Here") //Remains on current line
var variableName;
setMilliseconds()
30. To code a while statement in JavaScript
window.onload = function() {//actions here}
"
while (condition) {}
toString(base)
31. To get the text value of the control for radio buttons
toPrecision(precision)
document.getElementById("radioButtonId").value;
Src - e.g. <script src="fileName.js"> //
document.getElementById("CheckboxId").checked = true; //Could also be false
32. Number object method used to round numbers to the specified number of decimal places
Objects
document.getElementById("textAreaId").value;
sensitive
toFixed(digits)
33. To concatenate multiple parts into a string
document.getElementById("textAreaId").value;
Either single or double quotes surrounding the data
var stringVar = "part 1:" + "part 2";
document.getElementById("TextBoxId").value;
34. The string escape sequence to insert a form feed in JavaScript
f
toPrecision(precision)
document.getElementById("TextBoxId").disabled = true;
global
35. ________ comments start with / and end with /.
v
window.location()
Multi line
document.getElementById(id)
36. To assign the return value of confirm() to a variable
document.getElementById("ButtonId").onclick = functionName;
f
var answerVar = confirm("Message Text Here")
toString(base)
37. Math object method used to return a random number
Multi line
===
Math.random() //Returns a value >= 0.0 but <1.0
var stringVar = "part 1:" + "part 2";
38. To access the text element in a <span> tag
document.getElementById("spanId").firstChild;
document.getElementById("checkboxId").value;
window.location()
toLowerCase()
39. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
ondblclick
document.getElementById("listId").value;
Underscores
toString(base)
40. To code a button.onclick event handler
Math.ceil(number)
document.getElementById("TextBoxId").disabled = true;
document.getElementById("ButtonId").onclick = functionName;
Math.pow(number, power)
41. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
getTime()
<noscript>
toFixed(digitCount)
sensitive
42. To get the text value of the control for radio buttons
toLowerCase()
document.getElementById("checkboxId").value;
sensitive
Two forward slashes "//"
43. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
prompt("Text Here")
Two forward slashes "//"
setMilliseconds()
document.writeln("Text Here") //Advances to new line after text
44. To display an alert
toString()
var dateObject = new Date("11/22/2012 18:25:35")
getTime()
alert("Alert Text Here")
45. String object method used to concatenate multiple strings
document.getElementById("listId").value;
var dateVar = new Date()
concat(var1, var2, varN)
setMilliseconds()
46. To set the digit precision of a decimal number
<noscript>
toFixed(digitCount)
toFixed(digits)
document.getElementById("listId").value;
47. Number object method used to return a string with a given number base
Charset
standard equality operators
event handler .
toString(base)
48. Math object method used to return a given number rounded to the next highest integer value
document.getElementById("CheckboxId").checked = true; //Could also be false
Math.ceil(number)
var functionName = function(param1, param2, paramN) {}
!==
49. To make the browser load a new page using JavaScript
window.location = "New Web Address Here";
ondblclick
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.getElementById("TextBoxId").value;
50. The syntax of a conditional operator
if (condition) {}
Src - e.g. <script src="fileName.js"> //
prompt("Text Here")
(Condition_Expression) ? Value_If_True : Value_If_False;