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