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