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. Number object method used to return a number in exponential format with the specified number of decimal places
Math.floor(number)
document.getElementById("ButtonId").onclick = functionName;
var stringVar = prompt("Text Here")
toExponential(digits)
2. To assign the return value of confirm() to a variable
var answerVar = confirm("Message Text Here")
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Math.round(number)
document.getElementById("TextBoxId").disabled = true;
3. To access the text element in a <span> tag
document.getElementById("spanId").firstChild;
var stringVar = prompt("Text Here")
'
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
4. To display a confirmation
document.getElementById("listId").value;
Either single or double quotes surrounding the data
confirm("Message Text Here")
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
5. Math object method used to return the lowest value for a set of supplied numbers
Math.min(var1, var2, varN)
Either single or double quotes surrounding the data
isNaN(varHere) //Returns true or false.
Math.abs(number)
6. The four attributes of the <script> tag:Type - Src - _____ and Defer
v
Underscores
n
Charset
7. To create a function in JavaScript
Math.floor(number)
document.getElementById("TextBoxId").focus;
var functionName = function(param1, param2, paramN) {}
Math.max(var1, var2, varN)
8. Date object method used to return a string containing the date
substring(startIndex)
toDateString()
document.getElementById("textAreaId").value = "Text Value";
getFullYear()
9. To set the current value of the control for a text area
document.write("Text Here") //Remains on current line
confirm("Message Text Here")
var variableName;
document.getElementById("textAreaId").value = "Text Value";
10. To display an alert
document.getElementById("radioButtonId").value;
var dateVar = new Date()
global
alert("Alert Text Here")
11. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
event handler .
r
!==
Objects
12. To write a line to the current element of the DOM (Document Object Model)
document.getElementById("TextBoxId").focus;
document.getElementById("textAreaId").value;
var dateVar = new Date()
document.writeln("Text Here") //Advances to new line after text
13. The identity operator for not equal
!==
toTimeString()
alert("Alert Text Here")
confirm()
14. To assign a default value to a prompt
toLowerCase()
setMilliseconds()
Use the second parameter. Example: prompt("Enter Age:", "18")
confirm()
15. Math object method used to return the highest value from a set of supplied numbers
Math.max(var1, var2, varN)
document.getElementById("radioButtonId").checked = true; //Could also be false
focus
document.getElementById("textAreaId").value;
16. To set the digit precision of a decimal number
v
toString()
var stringVar = prompt("Text Here")
toFixed(digitCount)
17. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
toTimeString()
document.getElementById("TextBoxId").value;
Math.max(var1, var2, varN)
<noscript>
18. JavaScript is case _______
document.getElementById("checkboxId").checked;
event handler .
document.getElementById("TextBoxId").value;
sensitive
19. Math object method used to return the absolute value of a given number
Math.abs(number)
toUpperCase()
indexOf(searchValue, startPosition)
var dateObject = new Date("11/22/2012 18:25:35")
20. To insert Javascript into a web page
prompt("Text Here")
<script type="text/javascript">.....</script>
substring(startIndex)
<noscript>
21. ________ comments start with / and end with /.
redeclare
===
Multi line
toPrecision(precision)
22. To write text to the current element of the DOM
document.writeln("Text Here") //Advances to new line after text
Charset
document.write("Text Here") //Remains on current line
document.getElementById("checkboxId").value;
23. To assign the value from a prompt to a non-string variable
setMilliseconds()
document.getElementById("checkboxId").value;
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
standard equality operators
24. Number object method used to round numbers to the specified number of decimal places
document.getElementById("ButtonId").onclick = functionName;
document.getElementById("checkboxId").value;
toFixed(digits)
getFullYear()
25. To create an Array object in JavaScript
var arrayVar = new Array()
document.getElementById("radioButtonId").checked = true; //Could also be false
document.getElementById("TextBoxId").focus;
Charset
26. String object method used to return the position of the first instance of a specified search string starting from the specified index
substring(startIndex)
document.getElementById("radioButtonId").value;
indexOf(searchValue, startPosition)
toPrecision(precision)
27. The syntax of a conditional operator
Math.sqrt(number)
(Condition_Expression) ? Value_If_True : Value_If_False;
Src - e.g. <script src="fileName.js"> //
Charset
28. To denote a string in JavaScript
Math.round(number)
'
Either single or double quotes surrounding the data
toString()
29. The _____ attribute is used to denote external file for script use
document.getElementById("CheckboxId").checked = true; //Could also be false
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
Src - e.g. <script src="fileName.js"> //
focus
30. To access a page element by id
redeclare
document.getElementById(id)
Underscores
document.getElementById("TextBoxId").value;
31. Date object method used to return a string containing the date and time
toString()
var arrayVar = new Array()
Math.random() //Returns a value >= 0.0 but <1.0
document.getElementById("textAreaId").value = "Text Value";
32. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
toLowerCase()
ondblclick
Underscores
standard equality operators
33. What String object method returns a new string containing the value of the original string but in all lower case
Math.ceil(number)
Underscores
toLowerCase()
while (condition) {}
34. 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
35. To make the browser load a new page using JavaScript
\
Objects
window.location = "New Web Address Here";
toFixed(digits)
36. To assign the value from a prompt to a string
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.writeln("Text Here") //Advances to new line after text
document.write("Text Here") //Remains on current line
var stringVar = prompt("Text Here")
37. What String object method returns a new string containing the value of the original string but in all upper case
document.getElementById("spanId").firstChild.nodeValue = "New Value";
toString(base)
toExponential(digits)
toUpperCase()
38. To assign actions to the window onLoad event
window.onload = function() {//actions here}
expression
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
toString()
39. What Date object method is used to return the number of milliseconds since the start of GMT
'
Math.min(var1, var2, varN)
getTime()
toDateString()
40. The string escape sequence to insert a carriage return in JavaScript
'
r
getTime()
document.getElementById("CheckboxId").checked = true; //Could also be false
41. String object method used to get the character at a specified index position
document.writeln("Text Here") //Advances to new line after text
getTime()
Math.round(number)
charAt(position)
42. To code a for statement in JavaScript
Math.min(var1, var2, varN)
Underscores
toTimeString()
for (counter; condition; incrementor) {}
43. To create a single line comment in JavaScript
Underscores
var functionName = function(param1, param2, paramN) {}
document.getElementById("TextBoxId").focus;
Two forward slashes "//"
44. To set the current checked status of the control for radio buttons
toFixed(digits)
var dateVar = new Date()
Multi line
document.getElementById("radioButtonId").checked = true; //Could also be false
45. The format to create a new Date object from a string
expression
Math.min(var1, var2, varN)
window.location()
var dateObject = new Date("11/22/2012 18:25:35")
46. To code a button.onclick event handler
Objects
document.getElementById("textAreaId").value = "Text Value";
document.getElementById("ButtonId").onclick = functionName;
window.location = "New Web Address Here";
47. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
focus
Math.ceil(number)
var stringVar = "part 1:" + "part 2";
!==
48. The string escape sequence to start a new line in JavaScript
toTimeString()
toFixed(digitCount)
Underscores
n
49. To alter the value of the text element in a span tag
Charset
toString(base)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
window.onload = function() {//actions here}
50. To set the control to be disabled for textboxes
document.writeln("Text Here") //Advances to new line after text
toLowerCase()
document.getElementById("TextBoxId").disabled = true;
Charset