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