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 write a line to the current element of the DOM (Document Object Model)
<noscript>
var answerVar = confirm("Message Text Here")
document.writeln("Text Here") //Advances to new line after text
Math.abs(number)
2. The string escape sequence to insert a vertical tab in JavaScript
var stringVar = "part 1:" + "part 2";
v
prompt("Text Here")
semicolon ";"
3. Date object method used to return a string containing the date and time
var arrayVar = new Array()
toString()
if (condition) {}
for (counter; condition; incrementor) {}
4. Number object method used to return a string with a given number base
toString(base)
Either single or double quotes surrounding the data
Objects
window.location = "New Web Address Here";
5. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
toString(base)
ondblclick
Math.sqrt(number)
var functionName = function(param1, param2, paramN) {}
6. Statements end in JavaScript with a ________
Objects
'
document.getElementById(id)
semicolon ";"
7. To set the current checked status of the control for checkboxes
var stringVar = "part 1:" + "part 2";
document.getElementById("CheckboxId").checked = true; //Could also be false
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
window.location()
8. To set focus on the control for textboxes
document.getElementById("TextBoxId").focus;
toFixed(digitCount)
toString()
while (condition) {}
9. To create a single line comment in JavaScript
Two forward slashes "//"
confirm("Message Text Here")
getTime()
document.getElementById("TextBoxId").value;
10. Number object method used to return a numerical string with the specified number of significant digits
Math.max(var1, var2, varN)
sensitive
document.write("Text Here") //Remains on current line
toPrecision(precision)
11. To create a function that returns a value in JavaScript
var functionName = function(param1, param2, paramN) {}
document.getElementById("ButtonId").onclick = functionName;
concat(var1, var2, varN)
document.getElementById("listId").value;
12. A _______ variable can be changed and accessed from within and without a function or object.
confirm("Message Text Here")
<script type="text/javascript">.....</script>
global
toLowerCase()
13. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
document.getElementById("spanId").firstChild;
window.onload = function() {//actions here}
focus
<script type="text/javascript">.....</script>
14. To access the text element in a <span> tag
document.getElementById("spanId").firstChild;
getTime()
substring(startIndex)
document.writeln("Text Here") //Advances to new line after text
15. To code an If statement in JavaScript
confirm("Message Text Here")
toPrecision(precision)
Underscores
if (condition) {}
16. To make the browser load a new page using JavaScript
document.getElementById(id)
setMilliseconds()
window.location()
window.location = "New Web Address Here";
17. To write text to the current element of the DOM
document.write("Text Here") //Remains on current line
concat(var1, var2, varN)
t
Math.abs(number)
18. Math object method used to return the highest value from a set of supplied numbers
Math.ceil(number)
string
Math.max(var1, var2, varN)
Math.sqrt(number)
19. 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)
document.getElementById("listId").value;
isNaN(varHere) //Returns true or false.
Objects
20. To alter the value of the text element in a span tag
toUpperCase()
isNaN(varHere) //Returns true or false.
document.getElementById("radioButtonId").value;
document.getElementById("spanId").firstChild.nodeValue = "New Value";
21. The escape sequence used to insert a Unicode character into a string in JavaScript
alert("Alert Text Here")
udddd
document.getElementById("TextBoxId").focus;
ondblclick
22. The four attributes of the <script> tag:Type - Src - _____ and Defer
Charset
f
window.location()
var variableName;
23. The string escape sequence to insert a form feed in JavaScript
event handler .
f
charAt(position)
ondblclick
24. To create a function in JavaScript
var functionName = function(param1, param2, paramN) {}
Number.NEGATIVE_INFINITY
Math.random() //Returns a value >= 0.0 but <1.0
document.writeln("Text Here") //Advances to new line after text
25. Math object method used to return the lowest value for a set of supplied numbers
standard equality operators
Math.floor(number)
substring(startIndex)
Math.min(var1, var2, varN)
26. 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
27. To denote a string in JavaScript
Either single or double quotes surrounding the data
toExponential(digits)
Math.min(var1, var2, varN)
Number.NEGATIVE_INFINITY
28. The _____ attribute is used to denote external file for script use
document.getElementById("listId").value;
udddd
Src - e.g. <script src="fileName.js"> //
n
29. To get the current value for textboxes
confirm()
toString()
Math.round(number)
document.getElementById("TextBoxId").value;
30. 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
document.getElementById("spanId").firstChild.nodeValue = "New Value";
var stringVar = prompt("Text Here")
substring(startIndex, stopIndex)
expression
31. This returns only True or false values
confirm()
Underscores
t
var dateObject = new Date("11/22/2012 18:25:35")
32. The string escape sequence to start a new line in JavaScript
toPrecision(precision)
n
getTime()
document.writeln("Text Here") //Advances to new line after text
33. To access a page element by id
document.getElementById(id)
document.getElementById("TextBoxId").value;
toPrecision(precision)
substring(startIndex, stopIndex)
34. The identity operator for equals
expression
(Condition_Expression) ? Value_If_True : Value_If_False;
document.writeln("Text Here") //Advances to new line after text
===
35. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
Underscores
setMilliseconds()
document.getElementById("CheckboxId").checked = true; //Could also be false
toFixed(digitCount)
36. The format to create a new Date object from a string
document.getElementById("checkboxId").checked;
"
Underscores
var dateObject = new Date("11/22/2012 18:25:35")
37. To create a Date object in JavaScript
var dateVar = new Date()
Math.max(var1, var2, varN)
toUpperCase()
document.getElementById("spanId").firstChild.nodeValue = "New Value";
38. To assign a default value to a prompt
t
document.getElementById("ButtonId").onclick = functionName;
Use the second parameter. Example: prompt("Enter Age:", "18")
confirm()
39. To get the current checked status of the control for radio buttons
<noscript>
toFixed(digitCount)
semicolon ";"
document.getElementById("radioButtonId").checked;
40. The string escape sequence to insert a carriage return in JavaScript
expression
charAt(position)
r
document.getElementById("listId").value;
41. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
window.onload = function() {//actions here}
Objects
Math.random() //Returns a value >= 0.0 but <1.0
document.getElementById("spanId").firstChild.nodeValue = "New Value";
42. To set the digit precision of a decimal number
===
global
toFixed(digitCount)
document.getElementById("checkboxId").value;
43. JavaScript is case _______
Underscores
Either single or double quotes surrounding the data
getFullYear()
sensitive
44. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
document.getElementById(id)
event handler .
toExponential(digits)
window.onload = function() {//actions here}
45. To test that a variable contains a valid number
Math.pow(number, power)
Math.abs(number)
var stringVar = prompt("Text Here")
isNaN(varHere) //Returns true or false.
46. To assign the value from a prompt to a non-string variable
sensitive
===
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
var stringVar = "part 1:" + "part 2";
47. To code a for statement in JavaScript
document.getElementById("TextBoxId").focus;
for (counter; condition; incrementor) {}
sensitive
document.getElementById("checkboxId").checked;
48. Math object method used to return a random number
standard equality operators
Math.random() //Returns a value >= 0.0 but <1.0
event handler .
toString(base)
49. The string escape sequence to insert a double quote in JavaScript
Objects
"
===
Math.sqrt(number)
50. When you __________ a javascript variable it retains its original value
var stringVar = "part 1:" + "part 2";
redeclare
if (condition) {}
var variableName;