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 set the digit precision of a decimal number
v
document.getElementById("spanId").firstChild.nodeValue = "New Value";
<script type="text/javascript">.....</script>
toFixed(digitCount)
2. The escape sequence used to insert a Unicode character into a string in JavaScript
udddd
toString(base)
toLowerCase()
while (condition) {}
3. To create an Array object in JavaScript
document.getElementById(id)
r
f
var arrayVar = new Array()
4. To create a single line comment in JavaScript
Two forward slashes "//"
prompt("Text Here")
<script type="text/javascript">.....</script>
document.getElementById("checkboxId").checked;
5. Math object method used to return the highest value from a set of supplied numbers
standard equality operators
r
document.getElementById("listId").value;
Math.max(var1, var2, varN)
6. To code a while statement in JavaScript
substring(startIndex)
while (condition) {}
confirm("Message Text Here")
Src - e.g. <script src="fileName.js"> //
7. To assign the value from a prompt to a string
Math.abs(number)
redeclare
var stringVar = prompt("Text Here")
standard equality operators
8. String object method used to concatenate multiple strings
concat(var1, var2, varN)
confirm("Message Text Here")
toPrecision(precision)
document.getElementById("textAreaId").value = "Text Value";
9. To display an alert
===
redeclare
alert("Alert Text Here")
document.getElementById("TextBoxId").focus;
10. 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)
sensitive
var stringVar = "part 1:" + "part 2";
Objects
11. Math object method used to return a given number rounded to the next highest integer value
\
toFixed(digitCount)
Math.ceil(number)
substring(startIndex)
12. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
charAt(position)
Math.ceil(number)
document.getElementById("TextBoxId").value;
setMilliseconds()
13. To display a confirmation
window.onload = function() {//actions here}
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
(Condition_Expression) ? Value_If_True : Value_If_False;
confirm("Message Text Here")
14. Date object method used to return a string containing the time
toTimeString()
substring(startIndex, stopIndex)
semicolon ";"
document.getElementById("CheckboxId").checked = true; //Could also be false
15. Number object method used to return a number in exponential format with the specified number of decimal places
toString()
toExponential(digits)
Math.pow(number, power)
document.getElementById("TextBoxId").value;
16. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
toDateString()
<noscript>
sensitive
Math.abs(number)
17. Date object method used to return a string containing the date
window.location()
v
toDateString()
document.getElementById("checkboxId").checked;
18. 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
19. When you add a string and a number the result will be a ____
Math.sqrt(number)
string
window.onload = function() {//actions here}
indexOf(searchValue, startPosition)
20. The four attributes of the <script> tag:Type - Src - _____ and Defer
document.getElementById("radioButtonId").value;
n
toPrecision(precision)
Charset
21. The format to create a new Date object from a string
document.getElementById("textAreaId").value = "Text Value";
document.getElementById("textAreaId").value;
window.location = "New Web Address Here";
var dateObject = new Date("11/22/2012 18:25:35")
22. Unlike ________________ identity operators do not perform type coercion.
event handler .
\
semicolon ";"
standard equality operators
23. 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.writeln("Text Here") //Advances to new line after text
Math.floor(number)
substring(startIndex, stopIndex)
focus
24. To code a for statement in JavaScript
"
document.getElementById("checkboxId").value;
Math.max(var1, var2, varN)
for (counter; condition; incrementor) {}
25. What Date object method is used to return the number of milliseconds since the start of GMT
\
var arrayVar = new Array()
getTime()
window.location = "New Web Address Here";
26. Math object method used to return a given number that has been rounded to the closes integer value
Charset
standard equality operators
redeclare
Math.round(number)
27. Math object method used to return a given number raised to a given power
toDateString()
semicolon ";"
Math.floor(number)
Math.pow(number, power)
28. To assign the value from a prompt to a non-string variable
document.getElementById("radioButtonId").checked = true; //Could also be false
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
toString(base)
Objects
29. To make the browser load a new page using JavaScript
substring(startIndex)
focus
window.location = "New Web Address Here";
ondblclick
30. To code a button.onclick event handler
!==
Math.floor(number)
confirm()
document.getElementById("ButtonId").onclick = functionName;
31. To code an If statement in JavaScript
if (condition) {}
concat(var1, var2, varN)
var stringVar = "part 1:" + "part 2";
document.getElementById("CheckboxId").checked = true; //Could also be false
32. Math object method used to return a random number
document.getElementById("listId").value;
window.onload = function() {//actions here}
toPrecision(precision)
Math.random() //Returns a value >= 0.0 but <1.0
33. The _____ attribute is used to denote external file for script use
document.getElementById(id)
Multi line
udddd
Src - e.g. <script src="fileName.js"> //
34. To write text to the current element of the DOM
document.writeln("Text Here") //Advances to new line after text
ondblclick
charAt(position)
document.write("Text Here") //Remains on current line
35. To declare a variable in JavaScript
var variableName;
Underscores
var stringVar = prompt("Text Here")
window.location = "New Web Address Here";
36. To get the current checked status of the control for radio buttons
'
event handler .
redeclare
document.getElementById("radioButtonId").checked;
37. The string escape sequence to insert a carriage return in JavaScript
ondblclick
Use the second parameter. Example: prompt("Enter Age:", "18")
t
r
38. The string escape sequence to insert a vertical tab in JavaScript
expression
v
document.getElementById("ButtonId").onclick = functionName;
var dateVar = new Date()
39. To create a function that returns a value in JavaScript
standard equality operators
document.getElementById("textAreaId").value;
toTimeString()
var functionName = function(param1, param2, paramN) {}
40. A statement that yields a value
var functionName = function(param1, param2, paramN) {}
for (counter; condition; incrementor) {}
expression
toDateString()
41. Math object method used to return the lowest value for a set of supplied numbers
Math.min(var1, var2, varN)
document.getElementById("radioButtonId").value;
Math.ceil(number)
for (counter; condition; incrementor) {}
42. To get the text value of the control for radio buttons
var stringVar = prompt("Text Here")
substring(startIndex)
var functionName = function(param1, param2, paramN) {}
document.getElementById("radioButtonId").value;
43. JavaScript is case _______
(Condition_Expression) ? Value_If_True : Value_If_False;
alert("Alert Text Here")
window.location = "New Web Address Here";
sensitive
44. To set the current checked status of the control for radio buttons
getFullYear()
toFixed(digitCount)
<script type="text/javascript">.....</script>
document.getElementById("radioButtonId").checked = true; //Could also be false
45. To insert Javascript into a web page
window.onload = function() {//actions here}
alert("Alert Text Here")
redeclare
<script type="text/javascript">.....</script>
46. The syntax of a conditional operator
Math.sqrt(number)
(Condition_Expression) ? Value_If_True : Value_If_False;
toLowerCase()
Math.max(var1, var2, varN)
47. The string escape sequence to insert a double quote in JavaScript
toString()
while (condition) {}
substring(startIndex)
"
48. The string escape sequence to insert a tab in JavaScript
Two forward slashes "//"
t
document.getElementById("radioButtonId").value;
indexOf(searchValue, startPosition)
49. What String object method returns a new string containing the value of the original string but in all upper case
toTimeString()
prompt("Text Here")
toUpperCase()
toFixed(digitCount)
50. To get the current value for textboxes
var stringVar = prompt("Text Here")
document.getElementById("TextBoxId").value;
window.onload = function() {//actions here}
toExponential(digits)