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