SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
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 access a page element by id
Use the second parameter. Example: prompt("Enter Age:", "18")
document.getElementById("radioButtonId").checked = true; //Could also be false
toString()
document.getElementById(id)
2. The string escape sequence to insert a single quote in JavaScript
3. To get the current value for textboxes
if (condition) {}
document.getElementById("TextBoxId").value;
var functionName = function(param1, param2, paramN) {}
Underscores
4. To set the current checked status of the control for checkboxes
document.getElementById("CheckboxId").checked = true; //Could also be false
var answerVar = confirm("Message Text Here")
document.getElementById("radioButtonId").value;
r
5. Math object method used to return a given number rounded to the next highest integer value
redeclare
confirm()
Math.ceil(number)
charAt(position)
6. Number object method used to round numbers to the specified number of decimal places
document.getElementById("TextBoxId").disabled = true;
substring(startIndex)
global
toFixed(digits)
7. To create a function in JavaScript
var functionName = function(param1, param2, paramN) {}
confirm("Message Text Here")
Src - e.g. <script src="fileName.js"> //
Use the second parameter. Example: prompt("Enter Age:", "18")
8. The syntax of a conditional operator
toFixed(digitCount)
(Condition_Expression) ? Value_If_True : Value_If_False;
for (counter; condition; incrementor) {}
===
9. To create a Date object in JavaScript
document.getElementById("CheckboxId").checked = true; //Could also be false
n
var dateVar = new Date()
var dateObject = new Date("11/22/2012 18:25:35")
10. Math object method used to return a given number that has been rounded to the closes integer value
standard equality operators
document.getElementById("TextBoxId").value;
string
Math.round(number)
11. What String object method returns a new string containing the value of the original string but in all upper case
var functionName = function(param1, param2, paramN) {}
setMilliseconds()
semicolon ";"
toUpperCase()
12. String object method used to return the position of the first instance of a specified search string starting from the specified index
toDateString()
indexOf(searchValue, startPosition)
\
document.getElementById("CheckboxId").checked = true; //Could also be false
13. A statement that yields a value
v
expression
document.getElementById("CheckboxId").checked = true; //Could also be false
Use the second parameter. Example: prompt("Enter Age:", "18")
14. To view the current web address using JavaScript
semicolon ";"
window.location()
Use the second parameter. Example: prompt("Enter Age:", "18")
(Condition_Expression) ? Value_If_True : Value_If_False;
15. To write text to the current element of the DOM
document.write("Text Here") //Remains on current line
Math.round(number)
document.getElementById("radioButtonId").value;
<noscript>
16. The identity operator for not equal
!==
document.getElementById("checkboxId").checked;
Src - e.g. <script src="fileName.js"> //
document.getElementById("checkboxId").value;
17. Math object method used to return the highest value from a set of supplied numbers
"
Math.max(var1, var2, varN)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
substring(startIndex)
18. The string escape sequence to insert a tab in JavaScript
document.getElementById("TextBoxId").disabled = true;
t
string
!==
19. To set the current value of the control for a text area
Use the second parameter. Example: prompt("Enter Age:", "18")
getTime()
standard equality operators
document.getElementById("textAreaId").value = "Text Value";
20. To denote a string in JavaScript
===
confirm()
getTime()
Either single or double quotes surrounding the data
21. JavaScript is case _______
concat(var1, var2, varN)
sensitive
var stringVar = prompt("Text Here")
Multi line
22. Number object method used to return a number in exponential format with the specified number of decimal places
document.getElementById(id)
Math.min(var1, var2, varN)
toLowerCase()
toExponential(digits)
23. Statements end in JavaScript with a ________
getFullYear()
focus
semicolon ";"
expression
24. To create a function that returns a value in JavaScript
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
Src - e.g. <script src="fileName.js"> //
var functionName = function(param1, param2, paramN) {}
'
25. To concatenate multiple parts into a string
var arrayVar = new Array()
var stringVar = "part 1:" + "part 2";
Math.random() //Returns a value >= 0.0 but <1.0
indexOf(searchValue, startPosition)
26. What Date object method is used to return the number of milliseconds since the start of GMT
getTime()
sensitive
toString(base)
var answerVar = confirm("Message Text Here")
27. To set the current checked status of the control for radio buttons
Multi line
document.getElementById("textAreaId").value;
document.getElementById("radioButtonId").checked = true; //Could also be false
document.writeln("Text Here") //Advances to new line after text
28. To assign actions to the window onLoad event
expression
getTime()
window.onload = function() {//actions here}
toUpperCase()
29. To assign a default value to a prompt
redeclare
'
Use the second parameter. Example: prompt("Enter Age:", "18")
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
30. String object method used to concatenate multiple strings
Math.floor(number)
Multi line
string
concat(var1, var2, varN)
31. To access the text element in a <span> tag
alert("Alert Text Here")
document.getElementById("spanId").firstChild;
'
document.getElementById("TextBoxId").disabled = true;
32. String object method used to return a new string that contains part of the original string from the specified start position
var stringVar = prompt("Text Here")
alert("Alert Text Here")
substring(startIndex)
semicolon ";"
33. To get the current checked status of the control for radio buttons
event handler .
document.getElementById("radioButtonId").checked;
Math.floor(number)
window.onload = function() {//actions here}
34. The format to create a new Date object from a string
while (condition) {}
confirm()
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
var dateObject = new Date("11/22/2012 18:25:35")
35. To insert Javascript into a web page
<script type="text/javascript">.....</script>
===
concat(var1, var2, varN)
redeclare
36. Date object method used to return a string containing the time
toTimeString()
document.getElementById("TextBoxId").value;
getTime()
Charset
37. To get the text value of the control for radio buttons
t
window.location = "New Web Address Here";
var functionName = function(param1, param2, paramN) {}
document.getElementById("checkboxId").value;
38. To assign the value from a prompt to a string
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
substring(startIndex)
f
var stringVar = prompt("Text Here")
39. Math object method used to return a given number raised to a given power
ondblclick
confirm()
Math.pow(number, power)
event handler .
40. The string escape sequence to insert a carriage return in JavaScript
indexOf(searchValue, startPosition)
toPrecision(precision)
r
getTime()
41. Math object method used to return the square root of a given number
Math.sqrt(number)
var stringVar = "part 1:" + "part 2";
toPrecision(precision)
if (condition) {}
42. To code a for statement in JavaScript
document.getElementById("ButtonId").onclick = functionName;
toFixed(digits)
for (counter; condition; incrementor) {}
Underscores
43. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
setMilliseconds()
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
alert("Alert Text Here")
substring(startIndex, stopIndex)
44. The identity operator for equals
var arrayVar = new Array()
getFullYear()
===
window.onload = function() {//actions here}
45. Number object method used to return a string with a given number base
t
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
toString(base)
Math.round(number)
46. To get the value or the currently selected item for lists
!==
<noscript>
for (counter; condition; incrementor) {}
document.getElementById("listId").value;
47. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
Multi line
getFullYear()
Objects
confirm("Message Text Here")
48. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
Objects
Either single or double quotes surrounding the data
document.getElementById("checkboxId").value;
Math.ceil(number)
49. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
semicolon ";"
<noscript>
\
document.getElementById("listId").value;
50. Math object method used to return a random number
Two forward slashes "//"
Math.random() //Returns a value >= 0.0 but <1.0
toLowerCase()
Math.ceil(number)