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 alter the value of the text element in a span tag
document.getElementById("TextBoxId").value;
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
document.getElementById("spanId").firstChild.nodeValue = "New Value";
var dateObject = new Date("11/22/2012 18:25:35")
2. Math object method used to return a given number raised to a given power
document.getElementById("TextBoxId").disabled = true;
document.writeln("Text Here") //Advances to new line after text
document.getElementById("textAreaId").value = "Text Value";
Math.pow(number, power)
3. To create a Date object in JavaScript
<noscript>
document.getElementById(id)
var dateVar = new Date()
document.write("Text Here") //Remains on current line
4. The string escape sequence to insert a carriage return in JavaScript
document.getElementById("textAreaId").value = "Text Value";
expression
r
\
5. Math object method used to return a given number rounded to the next highest integer value
Math.ceil(number)
Objects
(Condition_Expression) ? Value_If_True : Value_If_False;
document.getElementById("ButtonId").onclick = functionName;
6. To code a button.onclick event handler
Objects
document.getElementById("ButtonId").onclick = functionName;
focus
document.getElementById("TextBoxId").value;
7. To access the text element in a <span> tag
Number.NEGATIVE_INFINITY
document.getElementById("spanId").firstChild;
toLowerCase()
Underscores
8. To access a page element by id
\
(Condition_Expression) ? Value_If_True : Value_If_False;
document.getElementById(id)
Objects
9. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
document.getElementById("textAreaId").value;
string
getFullYear()
Multi line
10. To create a single line comment in JavaScript
toExponential(digits)
f
Two forward slashes "//"
ondblclick
11. Math object method used to return the highest value from a set of supplied numbers
Use the second parameter. Example: prompt("Enter Age:", "18")
Math.max(var1, var2, varN)
redeclare
document.writeln("Text Here") //Advances to new line after text
12. Date object method used to return a string containing the date
concat(var1, var2, varN)
toDateString()
Math.pow(number, power)
Use the second parameter. Example: prompt("Enter Age:", "18")
13. Number object method used to return a numerical string with the specified number of significant digits
Multi line
setMilliseconds()
Math.round(number)
toPrecision(precision)
14. Number object method used to return a number in exponential format with the specified number of decimal places
sensitive
indexOf(searchValue, startPosition)
toExponential(digits)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
15. Math object method used to return a given number that has been rounded to the closes integer value
document.getElementById("radioButtonId").value;
Math.abs(number)
Math.round(number)
document.getElementById("TextBoxId").value;
16. Date object method used to return a string containing the time
window.location()
toTimeString()
semicolon ";"
document.getElementById(id)
17. Date object method used to return a string containing the date and time
toString()
var stringVar = prompt("Text Here")
Src - e.g. <script src="fileName.js"> //
var stringVar = "part 1:" + "part 2";
18. To concatenate multiple parts into a string
t
!==
var stringVar = "part 1:" + "part 2";
event handler .
19. The string escape sequence to insert a tab in JavaScript
document.getElementById("checkboxId").value;
t
toString()
window.location()
20. To set the control to be disabled for textboxes
document.getElementById("TextBoxId").disabled = true;
confirm()
document.write("Text Here") //Remains on current line
var variableName;
21. To test that a variable contains a valid number
isNaN(varHere) //Returns true or false.
getFullYear()
prompt("Text Here")
Math.floor(number)
22. To view the current web address using JavaScript
document.getElementById("TextBoxId").focus;
Either single or double quotes surrounding the data
window.location()
Math.abs(number)
23. To display a confirmation
redeclare
substring(startIndex)
focus
confirm("Message Text Here")
24. The string escape sequence to insert a backslash in JavaScript
Math.abs(number)
\
document.getElementById("TextBoxId").focus;
var answerVar = confirm("Message Text Here")
25. The syntax of a conditional operator
toDateString()
(Condition_Expression) ? Value_If_True : Value_If_False;
r
document.getElementById(id)
26. To display an alert
window.location()
document.getElementById("radioButtonId").value;
alert("Alert Text Here")
concat(var1, var2, varN)
27. To set the current value of the control for a text area
\
!==
document.getElementById("textAreaId").value = "Text Value";
Objects
28. The string escape sequence to insert a vertical tab in JavaScript
v
getTime()
global
document.getElementById("CheckboxId").checked = true; //Could also be false
29. To create an Array object in JavaScript
var arrayVar = new Array()
document.getElementById("TextBoxId").value;
toUpperCase()
t
30. The string escape sequence to insert a double quote in JavaScript
string
toFixed(digits)
document.getElementById("checkboxId").value;
"
31. Math object method used to return a random number
var functionName = function(param1, param2, paramN) {}
<script type="text/javascript">.....</script>
setMilliseconds()
Math.random() //Returns a value >= 0.0 but <1.0
32. To make the browser load a new page using JavaScript
toPrecision(precision)
toFixed(digitCount)
Math.round(number)
window.location = "New Web Address Here";
33. ________ comments start with / and end with /.
charAt(position)
Multi line
document.getElementById("radioButtonId").checked = true; //Could also be false
global
34. To get the text value of the control for radio buttons
Two forward slashes "//"
<noscript>
document.getElementById("checkboxId").value;
document.writeln("Text Here") //Advances to new line after text
35. The escape sequence used to insert a Unicode character into a string in JavaScript
toPrecision(precision)
udddd
toLowerCase()
document.getElementById("checkboxId").value;
36. To write a line to the current element of the DOM (Document Object Model)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
document.getElementById("CheckboxId").checked = true; //Could also be false
window.onload = function() {//actions here}
document.writeln("Text Here") //Advances to new line after text
37. Command to display a prompt
toLowerCase()
prompt("Text Here")
Src - e.g. <script src="fileName.js"> //
for (counter; condition; incrementor) {}
38. To get the value or the currently selected item for lists
document.getElementById("listId").value;
Charset
redeclare
toFixed(digitCount)
39. The identity operator for equals
Charset
===
var functionName = function(param1, param2, paramN) {}
semicolon ";"
40. Unlike ________________ identity operators do not perform type coercion.
getFullYear()
document.getElementById("ButtonId").onclick = functionName;
standard equality operators
if (condition) {}
41. To get the current value of the control for a text area
ondblclick
r
document.getElementById("textAreaId").value;
Math.max(var1, var2, varN)
42. To set the digit precision of a decimal number
global
toFixed(digitCount)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Math.max(var1, var2, varN)
43. To get the current checked status of the control for radio buttons
document.getElementById("radioButtonId").checked;
global
document.getElementById("textAreaId").value;
r
44. String object method used to return the position of the first instance of a specified search string starting from the specified index
indexOf(searchValue, startPosition)
standard equality operators
window.location = "New Web Address Here";
"
45. Math object method used to return the square root of a given number
var functionName = function(param1, param2, paramN) {}
Math.sqrt(number)
document.getElementById(id)
r
46. The four attributes of the <script> tag:Type - Src - _____ and Defer
var answerVar = confirm("Message Text Here")
Math.abs(number)
udddd
Charset
47. To get the current value for textboxes
substring(startIndex, stopIndex)
===
document.getElementById("TextBoxId").value;
ondblclick
48. To get the current checked status of the control for checkboxes
toString()
var stringVar = prompt("Text Here")
Math.random() //Returns a value >= 0.0 but <1.0
document.getElementById("checkboxId").checked;
49. To set the current checked status of the control for checkboxes
window.location()
confirm("Message Text Here")
document.getElementById("CheckboxId").checked = true; //Could also be false
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
50. When you add a string and a number the result will be a ____
string
Math.ceil(number)
Math.max(var1, var2, varN)
Multi line