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 code an If statement in JavaScript
Src - e.g. <script src="fileName.js"> //
Multi line
var stringVar = prompt("Text Here")
if (condition) {}
2. To set the current checked status of the control for radio buttons
document.getElementById("TextBoxId").value;
document.getElementById("radioButtonId").checked = true; //Could also be false
string
===
3. To get the current checked status of the control for checkboxes
expression
document.getElementById("checkboxId").checked;
document.getElementById("spanId").firstChild;
var functionName = function(param1, param2, paramN) {}
4. What String object method returns a new string containing the value of the original string but in all upper case
toPrecision(precision)
document.getElementById("spanId").firstChild.nodeValue = "New Value";
toUpperCase()
confirm("Message Text Here")
5. To assign the return value of confirm() to a variable
var answerVar = confirm("Message Text Here")
document.getElementById("radioButtonId").checked = true; //Could also be false
document.getElementById("TextBoxId").disabled = true;
window.onload = function() {//actions here}
6. To test that a variable contains a valid number
isNaN(varHere) //Returns true or false.
\
semicolon ";"
var dateObject = new Date("11/22/2012 18:25:35")
7. The available get methods for a Date object: getTime() - _________ - getMonth() - getDate() - getHours() - getMinutes() - getSeconds() - getMilliseconds()
===
document.getElementById("textAreaId").value = "Text Value";
document.getElementById("listId").value;
getFullYear()
8. To concatenate multiple parts into a string
var stringVar = "part 1:" + "part 2";
var answerVar = confirm("Message Text Here")
var variableName;
document.getElementById("radioButtonId").checked = true; //Could also be false
9. When you add a string and a number the result will be a ____
Src - e.g. <script src="fileName.js"> //
Two forward slashes "//"
document.getElementById("radioButtonId").checked = true; //Could also be false
string
10. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
Math.abs(number)
setMilliseconds()
t
confirm("Message Text Here")
11. To access the text element in a <span> tag
focus
toFixed(digits)
document.getElementById("spanId").firstChild;
document.getElementById("TextBoxId").value;
12. Date object method used to return a string containing the date
Math.floor(number)
global
Math.round(number)
toDateString()
13. Math object method used to return the highest value from a set of supplied numbers
document.getElementById("spanId").firstChild.nodeValue = "New Value";
document.getElementById("TextBoxId").disabled = true;
Multi line
Math.max(var1, var2, varN)
14. To get the value or the currently selected item for lists
var functionName = function(param1, param2, paramN) {}
toString()
Either single or double quotes surrounding the data
document.getElementById("listId").value;
15. Math object method used to return a given number raised to a given power
Math.pow(number, power)
window.location = "New Web Address Here";
toString()
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
16. The string escape sequence to start a new line in JavaScript
n
expression
global
charAt(position)
17. To create a single line comment in JavaScript
document.getElementById("checkboxId").checked;
Two forward slashes "//"
toFixed(digits)
Use the second parameter. Example: prompt("Enter Age:", "18")
18. String object method used to return a new string that contains part of the original string from the specified start position
window.onload = function() {//actions here}
concat(var1, var2, varN)
substring(startIndex)
confirm("Message Text Here")
19. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
Underscores
semicolon ";"
Math.floor(number)
Math.ceil(number)
20. Unlike ________________ identity operators do not perform type coercion.
\
document.getElementById("ButtonId").onclick = functionName;
standard equality operators
if (condition) {}
21. Math object method used to return the lowest value for a set of supplied numbers
"
var stringVar = "part 1:" + "part 2";
document.getElementById("spanId").firstChild;
Math.min(var1, var2, varN)
22. To create a function that returns a value in JavaScript
document.getElementById("TextBoxId").focus;
v
var functionName = function(param1, param2, paramN) {}
Math.ceil(number)
23. The string escape sequence to insert a tab in JavaScript
setMilliseconds()
t
semicolon ";"
if (condition) {}
24. To write text to the current element of the DOM
document.write("Text Here") //Remains on current line
window.location = "New Web Address Here";
Math.pow(number, power)
concat(var1, var2, varN)
25. The string escape sequence to insert a backslash in JavaScript
\
focus
\
document.getElementById("radioButtonId").checked = true; //Could also be false
26. This returns only True or false values
window.location = "New Web Address Here";
var answerVar = confirm("Message Text Here")
confirm()
prompt("Text Here")
27. Statements end in JavaScript with a ________
semicolon ";"
for (counter; condition; incrementor) {}
Objects
(Condition_Expression) ? Value_If_True : Value_If_False;
28. Math object method used to return a given number rounded to the next lowest integer value
Math.floor(number)
toString(base)
toExponential(digits)
toPrecision(precision)
29. String object method used to return the position of the first instance of a specified search string starting from the specified index
<script type="text/javascript">.....</script>
r
v
indexOf(searchValue, startPosition)
30. To alter the value of the text element in a span tag
focus
document.getElementById("spanId").firstChild.nodeValue = "New Value";
\
Two forward slashes "//"
31. String object method used to get the character at a specified index position
v
r
var stringVar = "part 1:" + "part 2";
charAt(position)
32. To code a while statement in JavaScript
Multi line
semicolon ";"
Use a parse. Example : var intVar = parseInt(prompt("Text Here"))
while (condition) {}
33. Date object method used to return a string containing the date and time
<script type="text/javascript">.....</script>
document.getElementById("radioButtonId").checked;
toString()
expression
34. The format to create a new Date object from a string
toFixed(digitCount)
document.getElementById("listId").value;
Underscores
var dateObject = new Date("11/22/2012 18:25:35")
35. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
concat(var1, var2, varN)
toString()
Objects
var dateVar = new Date()
36. To set the current checked status of the control for checkboxes
"
toDateString()
v
document.getElementById("CheckboxId").checked = true; //Could also be false
37. To code a for statement in JavaScript
for (counter; condition; incrementor) {}
sensitive
Math.round(number)
confirm()
38. Number object method used to return a numerical string with the specified number of significant digits
document.getElementById("radioButtonId").checked = true; //Could also be false
===
toPrecision(precision)
expression
39. To set the control to be disabled for textboxes
Math.floor(number)
window.onload = function() {//actions here}
document.getElementById("CheckboxId").checked = true; //Could also be false
document.getElementById("TextBoxId").disabled = true;
40. ________ comments start with / and end with /.
t
global
Multi line
Number.NEGATIVE_INFINITY
41. To denote a string in JavaScript
Charset
if (condition) {}
Either single or double quotes surrounding the data
concat(var1, var2, varN)
42. The syntax of a conditional operator
sensitive
document.getElementById("checkboxId").value;
(Condition_Expression) ? Value_If_True : Value_If_False;
\
43. To assign the value from a prompt to a string
document.getElementById("checkboxId").checked;
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
var stringVar = prompt("Text Here")
Math.random() //Returns a value >= 0.0 but <1.0
44. When you __________ a javascript variable it retains its original value
ondblclick
n
redeclare
concat(var1, var2, varN)
45. The escape sequence used to insert a Unicode character into a string in JavaScript
udddd
charAt(position)
document.write("Text Here") //Remains on current line
expression
46. The available properties for the Number object: Number.MAX_VALUE - Number.MIN_VALUE - Number.POSITIVE_INFINITY - _______ - Number.NaN
Number.NEGATIVE_INFINITY
udddd
toFixed(digits)
Two forward slashes "//"
47. What Date object method is used to return the number of milliseconds since the start of GMT
Math.floor(number)
var stringVar = prompt("Text Here")
isNaN(varHere) //Returns true or false.
getTime()
48. To get the text value of the control for radio buttons
t
window.onload = function() {//actions here}
document.getElementById("radioButtonId").value;
document.getElementById("ButtonId").onclick = functionName;
49. To view the current web address using JavaScript
udddd
substring(startIndex)
window.location()
document.getElementById("TextBoxId").value;
50. Command to display a prompt
expression
setMilliseconds()
document.getElementById("listId").value;
prompt("Text Here")