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