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 access a page element by id
charAt(position)
toFixed(digits)
Multi line
document.getElementById(id)
2. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
event handler .
standard equality operators
!==
toLowerCase()
3. To assign the value from a prompt to a string
Math.pow(number, power)
prompt("Text Here")
Charset
var stringVar = prompt("Text Here")
4. To set the digit precision of a decimal number
Math.round(number)
toFixed(digitCount)
toUpperCase()
window.onload = function() {//actions here}
5. A _______ variable can be changed and accessed from within and without a function or object.
global
document.getElementById("radioButtonId").checked = true; //Could also be false
toString()
substring(startIndex)
6. What String object method returns a new string containing the value of the original string but in all upper case
Math.round(number)
toUpperCase()
var dateObject = new Date("11/22/2012 18:25:35")
document.getElementById("spanId").firstChild.nodeValue = "New Value";
7. Command to display a prompt
document.getElementById("checkboxId").checked;
prompt("Text Here")
substring(startIndex, stopIndex)
var dateVar = new Date()
8. To display a confirmation
substring(startIndex, stopIndex)
"
focus
confirm("Message Text Here")
9. Math object method used to return a given number that has been rounded to the closes integer value
Either single or double quotes surrounding the data
Math.min(var1, var2, varN)
Math.round(number)
isNaN(varHere) //Returns true or false.
10. The syntax of a conditional operator
isNaN(varHere) //Returns true or false.
Number.NEGATIVE_INFINITY
(Condition_Expression) ? Value_If_True : Value_If_False;
expression
11. To alter the value of the text element in a span tag
standard equality operators
Math.pow(number, power)
f
document.getElementById("spanId").firstChild.nodeValue = "New Value";
12. Number object method used to round numbers to the specified number of decimal places
udddd
getFullYear()
standard equality operators
toFixed(digits)
13. To assign the return value of confirm() to a variable
Math.random() //Returns a value >= 0.0 but <1.0
var answerVar = confirm("Message Text Here")
Underscores
var dateVar = new Date()
14. To create an Array object in JavaScript
document.getElementById("listId").value;
var arrayVar = new Array()
Number.NEGATIVE_INFINITY
\
15. Math object method used to return the lowest value for a set of supplied numbers
Math.min(var1, var2, varN)
Math.random() //Returns a value >= 0.0 but <1.0
window.onload = function() {//actions here}
Math.floor(number)
16. To code an If statement in JavaScript
document.getElementById("textAreaId").value = "Text Value";
if (condition) {}
v
Use the second parameter. Example: prompt("Enter Age:", "18")
17. To assign a default value to a prompt
for (counter; condition; incrementor) {}
<script type="text/javascript">.....</script>
toTimeString()
Use the second parameter. Example: prompt("Enter Age:", "18")
18. When you __________ a javascript variable it retains its original value
redeclare
Underscores
toPrecision(precision)
f
19. Number object method used to return a numerical string with the specified number of significant digits
isNaN(varHere) //Returns true or false.
substring(startIndex, stopIndex)
toPrecision(precision)
f
20. The string escape sequence to insert a form feed in JavaScript
document.getElementById("radioButtonId").checked = true; //Could also be false
f
document.getElementById(id)
Two forward slashes "//"
21. To create a Date object in JavaScript
Math.random() //Returns a value >= 0.0 but <1.0
var dateVar = new Date()
document.getElementById("checkboxId").value;
toString()
22. String object method used to get the character at a specified index position
Number.NEGATIVE_INFINITY
document.getElementById("spanId").firstChild.nodeValue = "New Value";
document.writeln("Text Here") //Advances to new line after text
charAt(position)
23. To insert Javascript into a web page
document.getElementById("textAreaId").value = "Text Value";
toFixed(digits)
<script type="text/javascript">.....</script>
standard equality operators
24. To create a function in JavaScript
substring(startIndex, stopIndex)
v
document.getElementById("radioButtonId").value;
var functionName = function(param1, param2, paramN) {}
25. Math object method used to return a given number rounded to the next lowest integer value
var dateObject = new Date("11/22/2012 18:25:35")
"
document.getElementById("listId").value;
Math.floor(number)
26. The string escape sequence to insert a vertical tab in JavaScript
v
toString()
semicolon ";"
===
27. To create a single line comment in JavaScript
Two forward slashes "//"
sensitive
substring(startIndex, stopIndex)
document.getElementById(id)
28. To write text to the current element of the DOM
document.write("Text Here") //Remains on current line
confirm()
Objects
Src - e.g. <script src="fileName.js"> //
29. The identity operator for equals
charAt(position)
var arrayVar = new Array()
===
indexOf(searchValue, startPosition)
30. ________ comments start with / and end with /.
expression
prompt("Text Here")
Use the second parameter. Example: prompt("Enter Age:", "18")
Multi line
31. Math object method used to return a given number raised to a given power
Math.pow(number, power)
Math.min(var1, var2, varN)
document.getElementById("checkboxId").checked;
event handler .
32. Math object method used to return a given number rounded to the next highest integer value
Math.ceil(number)
var variableName;
focus
toTimeString()
33. To get the current value for textboxes
document.getElementById("TextBoxId").value;
document.getElementById("checkboxId").value;
alert("Alert Text Here")
setMilliseconds()
34. The string escape sequence to start a new line in JavaScript
toLowerCase()
event handler .
Math.pow(number, power)
n
35. Date object method used to return a string containing the date and time
toLowerCase()
toString()
document.getElementById("textAreaId").value;
r
36. To get the text value of the control for radio buttons
window.onload = function() {//actions here}
Math.round(number)
document.getElementById("checkboxId").value;
Math.max(var1, var2, varN)
37. To get the value or the currently selected item for lists
window.location()
document.getElementById(id)
document.getElementById("listId").value;
sensitive
38. Math object method used to return the square root of a given number
Math.sqrt(number)
setMilliseconds()
r
substring(startIndex, stopIndex)
39. The four attributes of the <script> tag:Type - Src - _____ and Defer
var arrayVar = new Array()
global
Charset
document.getElementById("TextBoxId").focus;
40. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
document.writeln("Text Here") //Advances to new line after text
event handler .
getFullYear()
'
41. To code a for statement in JavaScript
toFixed(digitCount)
for (counter; condition; incrementor) {}
document.getElementById("TextBoxId").disabled = true;
toExponential(digits)
42. The string escape sequence to insert a single quote in JavaScript
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
43. To write a line to the current element of the DOM (Document Object Model)
Underscores
document.writeln("Text Here") //Advances to new line after text
Multi line
string
44. JavaScript is case _______
sensitive
document.getElementById("CheckboxId").checked = true; //Could also be false
document.write("Text Here") //Remains on current line
udddd
45. To make the browser load a new page using JavaScript
document.getElementById("spanId").firstChild.nodeValue = "New Value";
window.location = "New Web Address Here";
toFixed(digits)
Objects
46. To display an alert
alert("Alert Text Here")
prompt("Text Here")
for (counter; condition; incrementor) {}
n
47. To test that a variable contains a valid number
redeclare
isNaN(varHere) //Returns true or false.
Math.abs(number)
document.getElementById("listId").value;
48. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
focus
(Condition_Expression) ? Value_If_True : Value_If_False;
ondblclick
toPrecision(precision)
49. To access the text element in a <span> tag
focus
Two forward slashes "//"
document.getElementById("spanId").firstChild;
standard equality operators
50. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
<script type="text/javascript">.....</script>
<noscript>
document.getElementById("listId").value;
var stringVar = "part 1:" + "part 2";