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 access a page element by id
var arrayVar = new Array()
document.getElementById(id)
setMilliseconds()
window.location()
2. The string escape sequence to insert a form feed in JavaScript
confirm("Message Text Here")
var dateVar = new Date()
(Condition_Expression) ? Value_If_True : Value_If_False;
f
3. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
var functionName = function(param1, param2, paramN) {}
charAt(position)
ondblclick
alert("Alert Text Here")
4. To create an Array object in JavaScript
document.getElementById("radioButtonId").checked = true; //Could also be false
window.location()
Multi line
var arrayVar = new Array()
5. To assign the value from a prompt to a string
toFixed(digitCount)
var stringVar = prompt("Text Here")
document.getElementById("checkboxId").value;
Math.sqrt(number)
6. 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.getElementById("radioButtonId").value;
while (condition) {}
confirm()
substring(startIndex, stopIndex)
7. To get the current checked status of the control for checkboxes
document.getElementById("TextBoxId").value;
window.onload = function() {//actions here}
document.getElementById("ButtonId").onclick = functionName;
document.getElementById("checkboxId").checked;
8. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
Math.ceil(number)
'
redeclare
Underscores
9. The syntax of a conditional operator
ondblclick
(Condition_Expression) ? Value_If_True : Value_If_False;
var dateVar = new Date()
var dateObject = new Date("11/22/2012 18:25:35")
10. Math object method used to return a random number
Math.random() //Returns a value >= 0.0 but <1.0
Charset
alert("Alert Text Here")
(Condition_Expression) ? Value_If_True : Value_If_False;
11. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
focus
document.getElementById("CheckboxId").checked = true; //Could also be false
var functionName = function(param1, param2, paramN) {}
Use the second parameter. Example: prompt("Enter Age:", "18")
12. To make the browser load a new page using JavaScript
substring(startIndex, stopIndex)
r
window.location = "New Web Address Here";
Src - e.g. <script src="fileName.js"> //
13. Math object method used to return the absolute value of a given number
Math.abs(number)
Math.max(var1, var2, varN)
Two forward slashes "//"
Math.pow(number, power)
14. The _____ attribute is used to denote external file for script use
toPrecision(precision)
Objects
charAt(position)
Src - e.g. <script src="fileName.js"> //
15. Math object method used to return a given number raised to a given power
focus
ondblclick
document.getElementById(id)
Math.pow(number, power)
16. To create a new Date object
document.getElementById(id)
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
getFullYear()
t
17. The string escape sequence to insert a carriage return in JavaScript
window.location()
r
Math.min(var1, var2, varN)
<noscript>
18. To assign a default value to a prompt
'
Use the second parameter. Example: prompt("Enter Age:", "18")
v
var stringVar = "part 1:" + "part 2";
19. To create a single line comment in JavaScript
document.getElementById("radioButtonId").checked;
Two forward slashes "//"
confirm("Message Text Here")
semicolon ";"
20. Command to display a prompt
Math.ceil(number)
substring(startIndex)
window.location()
prompt("Text Here")
21. String object method used to return a new string that contains part of the original string from the specified start position
substring(startIndex)
document.getElementById("TextBoxId").value;
event handler .
alert("Alert Text Here")
22. Math object method used to return a given number rounded to the next highest integer value
toTimeString()
Math.random() //Returns a value >= 0.0 but <1.0
var stringVar = prompt("Text Here")
Math.ceil(number)
23. To assign the return value of confirm() to a variable
document.writeln("Text Here") //Advances to new line after text
toLowerCase()
\
var answerVar = confirm("Message Text Here")
24. The format to create a new Date object from a string
document.getElementById("textAreaId").value = "Text Value";
confirm()
var dateObject = new Date("11/22/2012 18:25:35")
Objects
25. Number object method used to return a numerical string with the specified number of significant digits
toPrecision(precision)
for (counter; condition; incrementor) {}
toLowerCase()
expression
26. To get the text value of the control for radio buttons
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
prompt("Text Here")
document.getElementById("radioButtonId").value;
toString()
27. Math object method used to return the lowest value for a set of supplied numbers
Math.min(var1, var2, varN)
toFixed(digitCount)
document.getElementById("textAreaId").value;
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
28. What String object method returns a new string containing the value of the original string but in all upper case
var variableName;
toUpperCase()
!==
document.getElementById("radioButtonId").value;
29. To create a function that returns a value in JavaScript
document.getElementById("TextBoxId").focus;
getTime()
var functionName = function(param1, param2, paramN) {}
for (counter; condition; incrementor) {}
30. The string escape sequence to insert a tab in JavaScript
t
semicolon ";"
!==
document.getElementById("checkboxId").checked;
31. To display an alert
confirm("Message Text Here")
alert("Alert Text Here")
toString()
focus
32. The four attributes of the <script> tag:Type - Src - _____ and Defer
Charset
document.getElementById("radioButtonId").checked;
toString()
redeclare
33. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
document.getElementById("TextBoxId").focus;
setMilliseconds()
getTime()
document.getElementById("checkboxId").checked;
34. When you add a string and a number the result will be a ____
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
document.getElementById("ButtonId").onclick = functionName;
<noscript>
string
35. To set the digit precision of a decimal number
substring(startIndex)
\
"
toFixed(digitCount)
36. To code a while statement in JavaScript
while (condition) {}
var dateVar = new Date()
toExponential(digits)
string
37. Number object method used to round numbers to the specified number of decimal places
toFixed(digits)
Math.abs(number)
toFixed(digitCount)
event handler .
38. When you __________ a javascript variable it retains its original value
Objects
redeclare
document.getElementById("radioButtonId").value;
document.getElementById("TextBoxId").disabled = true;
39. To insert Javascript into a web page
toUpperCase()
<script type="text/javascript">.....</script>
while (condition) {}
confirm()
40. To display a confirmation
confirm("Message Text Here")
isNaN(varHere) //Returns true or false.
document.getElementById("TextBoxId").value;
Two forward slashes "//"
41. To declare a variable in JavaScript
var variableName;
n
charAt(position)
toString()
42. To set the control to be disabled for textboxes
redeclare
Math.pow(number, power)
document.getElementById("TextBoxId").disabled = true;
var dateObject = new Date("11/22/2012 18:25:35")
43. To set focus on the control for textboxes
focus
Math.abs(number)
toExponential(digits)
document.getElementById("TextBoxId").focus;
44. To test that a variable contains a valid number
expression
Underscores
isNaN(varHere) //Returns true or false.
if (condition) {}
45. To assign actions to the window onLoad event
window.onload = function() {//actions here}
Math.pow(number, power)
if (condition) {}
Objects
46. String object method used to concatenate multiple strings
toExponential(digits)
toString()
redeclare
concat(var1, var2, varN)
47. A _______ variable can be changed and accessed from within and without a function or object.
global
alert("Alert Text Here")
toString(base)
while (condition) {}
48. To get the current checked status of the control for radio buttons
Math.random() //Returns a value >= 0.0 but <1.0
\
var stringVar = "part 1:" + "part 2";
document.getElementById("radioButtonId").checked;
49. ________ comments start with / and end with /.
document.getElementById(id)
toDateString()
Multi line
document.getElementById("spanId").firstChild.nodeValue = "New Value";
50. JavaScript is case _______
window.location()
alert("Alert Text Here")
sensitive
global