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. To create a single line comment in JavaScript
Underscores
Two forward slashes "//"
var variableName;
Math.sqrt(number)
2. To get the text value of the control for radio buttons
document.getElementById("checkboxId").value;
Math.pow(number, power)
for (counter; condition; incrementor) {}
Two forward slashes "//"
3. To create a function that returns a value in JavaScript
var functionName = function(param1, param2, paramN) {}
string
event handler .
document.getElementById("TextBoxId").value;
4. To code a while statement in JavaScript
while (condition) {}
toString()
indexOf(searchValue, startPosition)
toDateString()
5. To display an alert
Math.pow(number, power)
alert("Alert Text Here")
getTime()
var answerVar = confirm("Message Text Here")
6. To write a line to the current element of the DOM (Document Object Model)
event handler .
var variableName;
Two forward slashes "//"
document.writeln("Text Here") //Advances to new line after text
7. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
\
Math.sqrt(number)
<noscript>
var functionName = function(param1, param2, paramN) {}
8. The string escape sequence to insert a tab in JavaScript
\
window.location = "New Web Address Here";
event handler .
t
9. JavaScript is case _______
document.getElementById("listId").value;
Math.floor(number)
sensitive
toString(base)
10. What String object method returns a new string containing the value of the original string but in all lower case
Math.floor(number)
var dateVar = new Date()
charAt(position)
toLowerCase()
11. To test that a variable contains a valid number
var stringVar = prompt("Text Here")
Multi line
isNaN(varHere) //Returns true or false.
window.location()
12. To code a button.onclick event handler
window.location()
Objects
n
document.getElementById("ButtonId").onclick = functionName;
13. To assign actions to the window onLoad event
Use the second parameter. Example: prompt("Enter Age:", "18")
window.onload = function() {//actions here}
var functionName = function(param1, param2, paramN) {}
(Condition_Expression) ? Value_If_True : Value_If_False;
14. To access a page element by id
document.getElementById(id)
Math.min(var1, var2, varN)
document.getElementById("radioButtonId").checked;
Charset
15. To write text to the current element of the DOM
document.getElementById("radioButtonId").checked = true; //Could also be false
document.getElementById("TextBoxId").disabled = true;
prompt("Text Here")
document.write("Text Here") //Remains on current line
16. To create a function in JavaScript
var functionName = function(param1, param2, paramN) {}
standard equality operators
document.getElementById("checkboxId").value;
window.location()
17. The string escape sequence to insert a vertical tab in JavaScript
Math.ceil(number)
Math.max(var1, var2, varN)
v
Math.random() //Returns a value >= 0.0 but <1.0
18. To assign the return value of confirm() to a variable
Number.NEGATIVE_INFINITY
var answerVar = confirm("Message Text Here")
r
toFixed(digits)
19. String object method used to concatenate multiple strings
var functionName = function(param1, param2, paramN) {}
concat(var1, var2, varN)
expression
getFullYear()
20. To get the text value of the control for radio buttons
document.getElementById("radioButtonId").value;
var dateObject = new Date("11/22/2012 18:25:35")
udddd
alert("Alert Text Here")
21. ________ comments start with / and end with /.
Either single or double quotes surrounding the data
Number.NEGATIVE_INFINITY
Multi line
\
22. To create a new Date object
toString(base)
n
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.getElementById("radioButtonId").checked;
23. This returns only True or false values
toString(base)
semicolon ";"
n
confirm()
24. The four attributes of the <script> tag:Type - Src - _____ and Defer
Multi line
Underscores
concat(var1, var2, varN)
Charset
25. Date object method used to return a string containing the date
var stringVar = prompt("Text Here")
Use the second parameter. Example: prompt("Enter Age:", "18")
document.getElementById("spanId").firstChild.nodeValue = "New Value";
toDateString()
26. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
getFullYear()
toLowerCase()
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.getElementById("radioButtonId").checked = true; //Could also be false
27. The identity operator for not equal
toPrecision(precision)
!==
document.getElementById("textAreaId").value = "Text Value";
window.location = "New Web Address Here";
28. Statements end in JavaScript with a ________
document.getElementById("radioButtonId").value;
semicolon ";"
v
var answerVar = confirm("Message Text Here")
29. To display a confirmation
Either single or double quotes surrounding the data
confirm("Message Text Here")
toDateString()
Underscores
30. Math object method used to return the square root of a given number
Math.round(number)
Math.sqrt(number)
t
window.location()
31. To set the digit precision of a decimal number
document.getElementById("checkboxId").checked;
Number.NEGATIVE_INFINITY
var arrayVar = new Array()
toFixed(digitCount)
32. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
udddd
window.location()
var stringVar = "part 1:" + "part 2";
Underscores
33. Number object method used to return a string with a given number base
Math.sqrt(number)
document.getElementById(id)
standard equality operators
toString(base)
34. Math object method used to return the lowest value for a set of supplied numbers
focus
toString()
Math.min(var1, var2, varN)
redeclare
35. The string escape sequence to insert a backslash in JavaScript
udddd
\
focus
Charset
36. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
toLowerCase()
'
Objects
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
37. String object method used to get the character at a specified index position
Objects
charAt(position)
document.getElementById("TextBoxId").disabled = true;
indexOf(searchValue, startPosition)
38. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
var arrayVar = new Array()
var functionName = function(param1, param2, paramN) {}
document.getElementById("checkboxId").checked;
focus
39. To get the current value of the control for a text area
document.getElementById("radioButtonId").checked;
toString(base)
document.getElementById("textAreaId").value;
var variableName;
40. To concatenate multiple parts into a string
var stringVar = "part 1:" + "part 2";
Objects
'
focus
41. To set the control to be disabled for textboxes
document.getElementById("radioButtonId").value;
Multi line
document.getElementById("TextBoxId").disabled = true;
toString(base)
42. To make the browser load a new page using JavaScript
Math.random() //Returns a value >= 0.0 but <1.0
toFixed(digitCount)
"
window.location = "New Web Address Here";
43. The format to create a new Date object from a string
substring(startIndex)
Two forward slashes "//"
var dateObject = new Date("11/22/2012 18:25:35")
getTime()
44. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
var arrayVar = new Array()
Math.max(var1, var2, varN)
prompt("Text Here")
event handler .
45. To set the current value of the control for a text area
var functionName = function(param1, param2, paramN) {}
document.getElementById("textAreaId").value = "Text Value";
document.getElementById("TextBoxId").disabled = true;
Math.ceil(number)
46. When you add a string and a number the result will be a ____
string
<noscript>
Multi line
standard equality operators
47. Math object method used to return the highest value from a set of supplied numbers
udddd
Math.max(var1, var2, varN)
var answerVar = confirm("Message Text Here")
global
48. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
var dateVar = new Date()
document.getElementById("TextBoxId").value;
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
setMilliseconds()
49. To get the current checked status of the control for radio buttons
Math.ceil(number)
document.getElementById("radioButtonId").checked;
document.getElementById("spanId").firstChild.nodeValue = "New Value";
confirm()
50. Math object method used to return a given number rounded to the next highest integer value
document.getElementById("ButtonId").onclick = functionName;
Use the second parameter. Example: prompt("Enter Age:", "18")
\
Math.ceil(number)