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 get the value or the currently selected item for lists
<noscript>
document.getElementById("listId").value;
var variableName;
focus
2. The escape sequence used to insert a Unicode character into a string in JavaScript
var stringVar = "part 1:" + "part 2";
udddd
confirm()
standard equality operators
3. To create an Array object in JavaScript
redeclare
var arrayVar = new Array()
ondblclick
confirm()
4. To view the current web address using JavaScript
window.location()
Math.abs(number)
<script type="text/javascript">.....</script>
Src - e.g. <script src="fileName.js"> //
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
substring(startIndex, stopIndex)
<noscript>
while (condition) {}
f
6. Date object method used to return a string containing the date and time
n
Math.random() //Returns a value >= 0.0 but <1.0
window.onload = function() {//actions here}
toString()
7. Math object method used to return a given number rounded to the next highest integer value
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Math.ceil(number)
document.getElementById("TextBoxId").focus;
if (condition) {}
8. To make the browser load a new page using JavaScript
window.location = "New Web Address Here";
document.getElementById("radioButtonId").value;
n
while (condition) {}
9. A _______ variable can be changed and accessed from within and without a function or object.
Charset
global
ondblclick
(Condition_Expression) ? Value_If_True : Value_If_False;
10. To display an alert
document.getElementById("textAreaId").value;
var dateVar = new Date()
===
alert("Alert Text Here")
11. Math object method used to return the absolute value of a given number
Math.abs(number)
!==
Math.min(var1, var2, varN)
event handler .
12. Unlike ________________ identity operators do not perform type coercion.
Math.floor(number)
Math.max(var1, var2, varN)
standard equality operators
toPrecision(precision)
13. Math object method used to return the square root of a given number
Math.sqrt(number)
!==
Src - e.g. <script src="fileName.js"> //
udddd
14. This returns only True or false values
var arrayVar = new Array()
Number.NEGATIVE_INFINITY
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
confirm()
15. To get the current value of the control for a text area
\
document.getElementById("textAreaId").value;
for (counter; condition; incrementor) {}
isNaN(varHere) //Returns true or false.
16. The string escape sequence to insert a carriage return in JavaScript
var functionName = function(param1, param2, paramN) {}
document.getElementById("radioButtonId").checked;
r
var arrayVar = new Array()
17. Math object method used to return a given number raised to a given power
Math.pow(number, power)
n
document.getElementById("textAreaId").value = "Text Value";
window.location()
18. What String object method returns a new string containing the value of the original string but in all lower case
toLowerCase()
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
toExponential(digits)
var dateVar = new Date()
19. To assign the return value of confirm() to a variable
var answerVar = confirm("Message Text Here")
document.write("Text Here") //Remains on current line
Underscores
document.getElementById("CheckboxId").checked = true; //Could also be false
20. Number object method used to round numbers to the specified number of decimal places
toFixed(digits)
var variableName;
\
global
21. To create a function in JavaScript
confirm()
Objects
Number.NEGATIVE_INFINITY
var functionName = function(param1, param2, paramN) {}
22. A statement that yields a value
document.writeln("Text Here") //Advances to new line after text
expression
Src - e.g. <script src="fileName.js"> //
(Condition_Expression) ? Value_If_True : Value_If_False;
23. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
Underscores
var stringVar = prompt("Text Here")
substring(startIndex, stopIndex)
Objects
24. To write text to the current element of the DOM
document.getElementById("ButtonId").onclick = functionName;
document.write("Text Here") //Remains on current line
document.getElementById("listId").value;
var functionName = function(param1, param2, paramN) {}
25. The four attributes of the <script> tag:Type - Src - _____ and Defer
var variableName;
===
Charset
if (condition) {}
26. To assign the value from a prompt to a string
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.getElementById("radioButtonId").checked = true; //Could also be false
var stringVar = prompt("Text Here")
redeclare
27. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
setMilliseconds()
getFullYear()
concat(var1, var2, varN)
<script type="text/javascript">.....</script>
28. 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
29. To code a button.onclick event handler
document.getElementById("textAreaId").value = "Text Value";
Use the second parameter. Example: prompt("Enter Age:", "18")
document.getElementById("ButtonId").onclick = functionName;
document.getElementById("checkboxId").checked;
30. Number object method used to return a numerical string with the specified number of significant digits
toPrecision(precision)
focus
document.getElementById("radioButtonId").value;
===
31. To code a for statement in JavaScript
concat(var1, var2, varN)
focus
for (counter; condition; incrementor) {}
Math.max(var1, var2, varN)
32. To alter the value of the text element in a span tag
document.getElementById("spanId").firstChild.nodeValue = "New Value";
t
Underscores
'
33. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
document.getElementById("radioButtonId").checked;
getFullYear()
Src - e.g. <script src="fileName.js"> //
charAt(position)
34. To code a while statement in JavaScript
toString(base)
var functionName = function(param1, param2, paramN) {}
while (condition) {}
Multi line
35. To test that a variable contains a valid number
window.onload = function() {//actions here}
isNaN(varHere) //Returns true or false.
toLowerCase()
Math.pow(number, power)
36. To assign the value from a prompt to a non-string variable
indexOf(searchValue, startPosition)
f
Math.random() //Returns a value >= 0.0 but <1.0
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
37. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
document.getElementById("TextBoxId").disabled = true;
focus
document.getElementById("ButtonId").onclick = functionName;
concat(var1, var2, varN)
38. The identity operator for equals
t
document.getElementById("TextBoxId").focus;
Math.sqrt(number)
===
39. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
Math.pow(number, power)
\
ondblclick
sensitive
40. To create a Date object in JavaScript
redeclare
var variableName;
var dateVar = new Date()
window.location()
41. When you add a string and a number the result will be a ____
document.getElementById("TextBoxId").focus;
var dateVar = new Date()
toString(base)
string
42. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
document.getElementById("listId").value;
substring(startIndex, stopIndex)
Math.max(var1, var2, varN)
event handler .
43. To display a confirmation
confirm()
event handler .
confirm("Message Text Here")
document.write("Text Here") //Remains on current line
44. To access a page element by id
(Condition_Expression) ? Value_If_True : Value_If_False;
udddd
document.getElementById(id)
event handler .
45. Math object method used to return a random number
!==
Math.max(var1, var2, varN)
Math.random() //Returns a value >= 0.0 but <1.0
global
46. To set the current value of the control for a text area
sensitive
document.getElementById("textAreaId").value = "Text Value";
toPrecision(precision)
document.getElementById("TextBoxId").value;
47. To get the current checked status of the control for radio buttons
document.getElementById("radioButtonId").checked;
Math.min(var1, var2, varN)
document.writeln("Text Here") //Advances to new line after text
for (counter; condition; incrementor) {}
48. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
<noscript>
document.getElementById("checkboxId").checked;
document.getElementById("TextBoxId").disabled = true;
var stringVar = prompt("Text Here")
49. To set focus on the control for textboxes
event handler .
standard equality operators
document.getElementById("TextBoxId").focus;
r
50. String object method used to return a new string that contains part of the original string from the specified start position
substring(startIndex)
Math.max(var1, var2, varN)
document.getElementById("radioButtonId").checked = true; //Could also be false
document.getElementById("checkboxId").checked;