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 available properties for the Number object: Number.MAX_VALUE - Number.MIN_VALUE - Number.POSITIVE_INFINITY - _______ - Number.NaN
isNaN(varHere) //Returns true or false.
var dateVar = new Date()
Number.NEGATIVE_INFINITY
document.getElementById("checkboxId").value;
2. To assign the return value of confirm() to a variable
document.getElementById("textAreaId").value;
var answerVar = confirm("Message Text Here")
n
r
3. Math object method used to return a random number
Math.random() //Returns a value >= 0.0 but <1.0
substring(startIndex, stopIndex)
document.writeln("Text Here") //Advances to new line after text
Math.abs(number)
4. Number object method used to return a numerical string with the specified number of significant digits
toFixed(digitCount)
document.getElementById("ButtonId").onclick = functionName;
toPrecision(precision)
document.getElementById("checkboxId").value;
5. To assign actions to the window onLoad event
substring(startIndex, stopIndex)
document.getElementById(id)
string
window.onload = function() {//actions here}
6. To display an alert
toExponential(digits)
alert("Alert Text Here")
document.getElementById("textAreaId").value;
getFullYear()
7. To test that a variable contains a valid number
window.location = "New Web Address Here";
t
!==
isNaN(varHere) //Returns true or false.
8. To get the current checked status of the control for checkboxes
Number.NEGATIVE_INFINITY
toPrecision(precision)
redeclare
document.getElementById("checkboxId").checked;
9. To assign the value from a prompt to a non-string variable
confirm()
toString()
<noscript>
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
10. String object method used to return a new string that contains part of the original string from the specified start position
confirm("Message Text Here")
substring(startIndex)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
window.location()
11. Date object method used to return a string containing the date and time
Src - e.g. <script src="fileName.js"> //
toString()
var functionName = function(param1, param2, paramN) {}
toString(base)
12. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
v
Math.floor(number)
ondblclick
Math.max(var1, var2, varN)
13. To get the text value of the control for radio buttons
document.getElementById("spanId").firstChild.nodeValue = "New Value";
document.getElementById("checkboxId").value;
Src - e.g. <script src="fileName.js"> //
toDateString()
14. Math object method used to return the highest value from a set of supplied numbers
Math.max(var1, var2, varN)
for (counter; condition; incrementor) {}
Number.NEGATIVE_INFINITY
var dateObject = new Date("11/22/2012 18:25:35")
15. To get the text value of the control for radio buttons
document.getElementById("listId").value;
var dateVar = new Date()
global
document.getElementById("radioButtonId").value;
16. To insert Javascript into a web page
string
toString(base)
var answerVar = confirm("Message Text Here")
<script type="text/javascript">.....</script>
17. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
toString(base)
concat(var1, var2, varN)
Underscores
substring(startIndex)
18. To assign the value from a prompt to a string
\
var stringVar = prompt("Text Here")
Math.min(var1, var2, varN)
'
19. To get the value or the currently selected item for lists
document.getElementById("listId").value;
substring(startIndex, stopIndex)
alert("Alert Text Here")
Math.pow(number, power)
20. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
event handler .
if (condition) {}
document.getElementById("CheckboxId").checked = true; //Could also be false
var dateObject = new Date("11/22/2012 18:25:35")
21. Math object method used to return a given number that has been rounded to the closes integer value
Charset
redeclare
Math.round(number)
===
22. To access a page element by id
window.location()
toExponential(digits)
document.getElementById(id)
var answerVar = confirm("Message Text Here")
23. What String object method returns a new string containing the value of the original string but in all lower case
window.location = "New Web Address Here";
toLowerCase()
document.getElementById("checkboxId").value;
sensitive
24. The string escape sequence to insert a carriage return in JavaScript
document.getElementById("radioButtonId").checked;
semicolon ";"
'
r
25. To access the text element in a <span> tag
confirm("Message Text Here")
Objects
document.getElementById("spanId").firstChild;
var dateVar = new Date()
26. To display a confirmation
concat(var1, var2, varN)
toString(base)
Use the second parameter. Example: prompt("Enter Age:", "18")
confirm("Message Text Here")
27. To code an If statement in JavaScript
if (condition) {}
document.writeln("Text Here") //Advances to new line after text
sensitive
'
28. To set the current checked status of the control for checkboxes
v
document.getElementById("CheckboxId").checked = true; //Could also be false
confirm("Message Text Here")
var dateVar = new Date()
29. JavaScript is case _______
toPrecision(precision)
Math.max(var1, var2, varN)
sensitive
Underscores
30. The _____ attribute is used to denote external file for script use
var arrayVar = new Array()
var functionName = function(param1, param2, paramN) {}
Src - e.g. <script src="fileName.js"> //
document.writeln("Text Here") //Advances to new line after text
31. Unlike ________________ identity operators do not perform type coercion.
===
Math.max(var1, var2, varN)
standard equality operators
udddd
32. To create a single line comment in JavaScript
Number.NEGATIVE_INFINITY
window.location = "New Web Address Here";
Two forward slashes "//"
===
33. What Date object method is used to return the number of milliseconds since the start of GMT
Math.sqrt(number)
\
getTime()
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
34. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
Math.max(var1, var2, varN)
window.onload = function() {//actions here}
<noscript>
Src - e.g. <script src="fileName.js"> //
35. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
document.getElementById("CheckboxId").checked = true; //Could also be false
setMilliseconds()
Use the second parameter. Example: prompt("Enter Age:", "18")
toString(base)
36. To set the current value of the control for a text area
toTimeString()
var answerVar = confirm("Message Text Here")
Use the second parameter. Example: prompt("Enter Age:", "18")
document.getElementById("textAreaId").value = "Text Value";
37. The syntax of a conditional operator
(Condition_Expression) ? Value_If_True : Value_If_False;
document.getElementById("radioButtonId").checked;
n
"
38. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
indexOf(searchValue, startPosition)
semicolon ";"
focus
document.getElementById("listId").value;
39. String object method used to return a new string that contains part of the original string from the specified start position and up to but not including the specified stop index
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
f
string
substring(startIndex, stopIndex)
40. Math object method used to return the square root of a given number
document.getElementById("spanId").firstChild;
Math.sqrt(number)
confirm()
standard equality operators
41. The string escape sequence to insert a backslash in JavaScript
toFixed(digitCount)
global
document.getElementById("spanId").firstChild;
\
42. To code a for statement in JavaScript
document.getElementById(id)
<noscript>
document.getElementById("TextBoxId").disabled = true;
for (counter; condition; incrementor) {}
43. The string escape sequence to insert a single quote in JavaScript
44. Math object method used to return the lowest value for a set of supplied numbers
document.getElementById("ButtonId").onclick = functionName;
Math.min(var1, var2, varN)
Two forward slashes "//"
toFixed(digits)
45. To set the digit precision of a decimal number
Math.min(var1, var2, varN)
var answerVar = confirm("Message Text Here")
toFixed(digitCount)
Multi line
46. Math object method used to return the absolute value of a given number
document.getElementById("radioButtonId").value;
toUpperCase()
Math.max(var1, var2, varN)
Math.abs(number)
47. To view the current web address using JavaScript
window.location()
Math.abs(number)
n
toFixed(digitCount)
48. To write text to the current element of the DOM
document.write("Text Here") //Remains on current line
toLowerCase()
concat(var1, var2, varN)
Math.pow(number, power)
49. To create a Date object in JavaScript
while (condition) {}
var dateVar = new Date()
indexOf(searchValue, startPosition)
string
50. The string escape sequence to insert a vertical tab in JavaScript
toTimeString()
Two forward slashes "//"
document.write("Text Here") //Remains on current line
v