SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
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 non-string variable
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
for (counter; condition; incrementor) {}
document.getElementById("spanId").firstChild.nodeValue = "New Value";
var functionName = function(param1, param2, paramN) {}
2. The events common to most controls: onfocus - onblur - onclick - _______ - onchange - onselect
ondblclick
substring(startIndex, stopIndex)
document.getElementById("TextBoxId").focus;
Objects
3. To view the current web address using JavaScript
Math.ceil(number)
indexOf(searchValue, startPosition)
'
window.location()
4. Math object method used to return a given number rounded to the next highest integer value
for (counter; condition; incrementor) {}
Math.ceil(number)
Math.floor(number)
charAt(position)
5. To assign the return value of confirm() to a variable
prompt("Text Here")
var answerVar = confirm("Message Text Here")
window.onload = function() {//actions here}
for (counter; condition; incrementor) {}
6. To create a single line comment in JavaScript
getTime()
document.getElementById("radioButtonId").checked = true; //Could also be false
Objects
Two forward slashes "//"
7. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
document.getElementById("TextBoxId").disabled = true;
'
Underscores
sensitive
8. What Date object method is used to return the number of milliseconds since the start of GMT
document.writeln("Text Here") //Advances to new line after text
getTime()
var dateVar = new Date()
Math.pow(number, power)
9. String object method used to get the character at a specified index position
===
"
charAt(position)
toExponential(digits)
10. To create a function in JavaScript
var functionName = function(param1, param2, paramN) {}
Math.sqrt(number)
document.write("Text Here") //Remains on current line
document.getElementById(id)
11. The syntax of a conditional operator
document.writeln("Text Here") //Advances to new line after text
document.getElementById("ButtonId").onclick = functionName;
(Condition_Expression) ? Value_If_True : Value_If_False;
Src - e.g. <script src="fileName.js"> //
12. To create a Date object in JavaScript
Math.random() //Returns a value >= 0.0 but <1.0
substring(startIndex, stopIndex)
!==
var dateVar = new Date()
13. To create a function that returns a value in JavaScript
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
var functionName = function(param1, param2, paramN) {}
toLowerCase()
var stringVar = prompt("Text Here")
14. The ________ tag is used to display the text between the opening and closing tag if JavaScript is disabled or otherwise not available
<noscript>
document.getElementById("TextBoxId").disabled = true;
document.getElementById("radioButtonId").checked = true; //Could also be false
var stringVar = "part 1:" + "part 2";
15. Date object method used to return a string containing the time
toString()
udddd
toTimeString()
toExponential(digits)
16. A function that is called with a certain event occurs - e.g. button.onclick and window.onload.
getFullYear()
document.getElementById("textAreaId").value;
event handler .
var functionName = function(param1, param2, paramN) {}
17. The string escape sequence to insert a carriage return in JavaScript
standard equality operators
document.getElementById("checkboxId").checked;
r
window.location()
18. To denote a string in JavaScript
v
Either single or double quotes surrounding the data
redeclare
string
19. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
document.getElementById("textAreaId").value = "Text Value";
getFullYear()
!==
Math.floor(number)
20. To set the current value of the control for a text area
document.getElementById("textAreaId").value = "Text Value";
Two forward slashes "//"
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
global
21. A statement that yields a value
Either single or double quotes surrounding the data
(Condition_Expression) ? Value_If_True : Value_If_False;
Charset
expression
22. To alter the value of the text element in a span tag
global
document.getElementById("CheckboxId").checked = true; //Could also be false
'
document.getElementById("spanId").firstChild.nodeValue = "New Value";
23. To display an alert
alert("Alert Text Here")
document.getElementById("spanId").firstChild;
<script type="text/javascript">.....</script>
Two forward slashes "//"
24. The four attributes of the <script> tag:Type - Src - _____ and Defer
setMilliseconds()
Charset
Math.sqrt(number)
document.getElementById(id)
25. What String object method returns a new string containing the value of the original string but in all lower case
r
for (counter; condition; incrementor) {}
toLowerCase()
Math.abs(number)
26. To code a while statement in JavaScript
while (condition) {}
document.getElementById("listId").value;
var functionName = function(param1, param2, paramN) {}
isNaN(varHere) //Returns true or false.
27. String object method used to return the position of the first instance of a specified search string starting from the specified index
Two forward slashes "//"
indexOf(searchValue, startPosition)
var variableName;
expression
28. Number object method used to return a number in exponential format with the specified number of decimal places
document.getElementById("spanId").firstChild;
window.location()
toExponential(digits)
semicolon ";"
29. The escape sequence used to insert a Unicode character into a string in JavaScript
udddd
toString(base)
var variableName;
var arrayVar = new Array()
30. Command to display a prompt
toString()
prompt("Text Here")
Math.round(number)
n
31. To get the current value for textboxes
document.getElementById("TextBoxId").value;
Math.floor(number)
document.getElementById("TextBoxId").disabled = true;
var stringVar = prompt("Text Here")
32. To declare a variable in JavaScript
!==
window.location = "New Web Address Here";
var variableName;
t
33. To test that a variable contains a valid number
toUpperCase()
document.getElementById("TextBoxId").disabled = true;
isNaN(varHere) //Returns true or false.
toFixed(digits)
34. To get the value or the currently selected item for lists
document.getElementById("textAreaId").value = "Text Value";
prompt("Text Here")
var stringVar = "part 1:" + "part 2";
document.getElementById("listId").value;
35. 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
udddd
sensitive
Multi line
substring(startIndex, stopIndex)
36. Math object method used to return a given number raised to a given power
redeclare
f
document.write("Text Here") //Remains on current line
Math.pow(number, power)
37. String object method used to return a new string that contains part of the original string from the specified start position
substring(startIndex)
if (condition) {}
document.getElementById("listId").value;
global
38. The format to create a new Date object from a string
var dateObject = new Date("11/22/2012 18:25:35")
document.getElementById("TextBoxId").focus;
alert("Alert Text Here")
getTime()
39. The string escape sequence to insert a form feed in JavaScript
Two forward slashes "//"
f
!==
Either single or double quotes surrounding the data
40. Number object method used to return a numerical string with the specified number of significant digits
toPrecision(precision)
sensitive
document.getElementById("TextBoxId").focus;
!==
41. The string escape sequence to insert a single quote in JavaScript
42. To assign a default value to a prompt
event handler .
var arrayVar = new Array()
Use the second parameter. Example: prompt("Enter Age:", "18")
document.getElementById("spanId").firstChild.nodeValue = "New Value";
43. To set the current checked status of the control for checkboxes
document.write("Text Here") //Remains on current line
document.getElementById("CheckboxId").checked = true; //Could also be false
confirm("Message Text Here")
substring(startIndex)
44. Number object method used to round numbers to the specified number of decimal places
n
Math.pow(number, power)
document.getElementById(id)
toFixed(digits)
45. Math object method used to return the lowest value for a set of supplied numbers
event handler .
if (condition) {}
Math.min(var1, var2, varN)
document.getElementById("listId").value;
46. To create an Array object in JavaScript
indexOf(searchValue, startPosition)
document.getElementById("TextBoxId").focus;
event handler .
var arrayVar = new Array()
47. To get the text value of the control for radio buttons
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
document.getElementById("TextBoxId").value;
document.getElementById("checkboxId").value;
Math.random() //Returns a value >= 0.0 but <1.0
48. The identity operator for equals
string
'
var stringVar = prompt("Text Here")
===
49. The string escape sequence to insert a backslash in JavaScript
var functionName = function(param1, param2, paramN) {}
substring(startIndex, stopIndex)
\
Math.random() //Returns a value >= 0.0 but <1.0
50. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
toString()
focus
redeclare
getTime()