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. String object method used to concatenate multiple strings
concat(var1, var2, varN)
var dateObject = new Date("11/22/2012 18:25:35")
document.getElementById("listId").value;
Math.pow(number, power)
2. Math object method used to return a given number rounded to the next highest integer value
Math.round(number)
substring(startIndex, stopIndex)
Multi line
Math.ceil(number)
3. Math object method used to return a given number raised to a given power
Either single or double quotes surrounding the data
Math.round(number)
Math.pow(number, power)
Charset
4. To view the current web address using JavaScript
var dateVar = new Date()
substring(startIndex, stopIndex)
'
window.location()
5. To write a line to the current element of the DOM (Document Object Model)
'
document.writeln("Text Here") //Advances to new line after text
document.getElementById("TextBoxId").value;
alert("Alert Text Here")
6. A _______ variable can be changed and accessed from within and without a function or object.
global
document.getElementById("spanId").firstChild.nodeValue = "New Value";
document.getElementById("textAreaId").value;
var dateObject = new Date("11/22/2012 18:25:35")
7. To create a function in JavaScript
substring(startIndex)
var functionName = function(param1, param2, paramN) {}
expression
toPrecision(precision)
8. Math object method used to return the square root of a given number
var dateObject = new Date("11/22/2012 18:25:35")
document.getElementById("radioButtonId").value;
Math.sqrt(number)
confirm()
9. To get the text value of the control for radio buttons
document.getElementById("radioButtonId").value;
document.write("Text Here") //Remains on current line
if (condition) {}
getFullYear()
10. Unlike ________________ identity operators do not perform type coercion.
for (counter; condition; incrementor) {}
standard equality operators
var variableName;
expression
11. To get the current checked status of the control for radio buttons
document.getElementById("TextBoxId").focus;
document.getElementById("spanId").firstChild.nodeValue = "New Value";
\
document.getElementById("radioButtonId").checked;
12. When you __________ a javascript variable it retains its original value
alert("Alert Text Here")
document.getElementById("radioButtonId").checked;
Either single or double quotes surrounding the data
redeclare
13. The four attributes of the <script> tag:Type - Src - _____ and Defer
Charset
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
substring(startIndex, stopIndex)
getTime()
14. The string escape sequence to start a new line in JavaScript
confirm()
toExponential(digits)
getTime()
n
15. The identity operator for equals
===
sensitive
r
"
16. The valid characters for an identifier in JavaScript: Letters - Numbers - ________ and Dollar Signs
toExponential(digits)
concat(var1, var2, varN)
Underscores
var functionName = function(param1, param2, paramN) {}
17. The string escape sequence to insert a carriage return in JavaScript
n
toFixed(digits)
concat(var1, var2, varN)
r
18. To create a new Date object
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
toTimeString()
var stringVar = prompt("Text Here")
getFullYear()
19. Date object method used to return a string containing the date and time
getFullYear()
toString()
var functionName = function(param1, param2, paramN) {}
var dateObject = new Date("11/22/2012 18:25:35")
20. To insert Javascript into a web page
document.writeln("Text Here") //Advances to new line after text
document.getElementById("textAreaId").value;
<script type="text/javascript">.....</script>
Math.ceil(number)
21. To get the text value of the control for radio buttons
toFixed(digitCount)
document.getElementById("checkboxId").value;
Src - e.g. <script src="fileName.js"> //
document.getElementById("TextBoxId").value;
22. The two methods common to most controls: ______ //Brings focus to the control blur //Removes focus from the control
var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds)
document.getElementById("checkboxId").checked;
getTime()
focus
23. To set focus on the control for textboxes
document.getElementById("TextBoxId").focus;
var stringVar = "part 1:" + "part 2";
standard equality operators
global
24. To create a function that returns a value in JavaScript
var functionName = function(param1, param2, paramN) {}
<script type="text/javascript">.....</script>
Objects
toPrecision(precision)
25. ________ comments start with / and end with /.
f
substring(startIndex, stopIndex)
document.getElementById("textAreaId").value;
Multi line
26. A list-like construct that has properties which corresponds to JavaScript values or variables or other objects.
Charset
Objects
document.getElementById("spanId").firstChild.nodeValue = "New Value";
Math.abs(number)
27. The string escape sequence to insert a backslash in JavaScript
document.write("Text Here") //Remains on current line
\
confirm("Message Text Here")
standard equality operators
28. To access the text element in a <span> tag
document.getElementById("spanId").firstChild;
Src - e.g. <script src="fileName.js"> //
string
<script type="text/javascript">.....</script>
29. To set the current value of the control for a text area
var functionName = function(param1, param2, paramN) {}
document.getElementById("textAreaId").value = "Text Value";
toLowerCase()
Math.floor(number)
30. What Date object method is used to return the number of milliseconds since the start of GMT
var answerVar = confirm("Message Text Here")
isNaN(varHere) //Returns true or false.
getTime()
document.getElementById("spanId").firstChild;
31. To assign actions to the window onLoad event
string
var stringVar = "part 1:" + "part 2";
var arrayVar = new Array()
window.onload = function() {//actions here}
32. When you add a string and a number the result will be a ____
document.getElementById("checkboxId").value;
window.location = "New Web Address Here";
isNaN(varHere) //Returns true or false.
string
33. The available set methods for a Date object: setFullYear() - setMonth() - setDate() - setHours() - setMinutes() - setSeconds() - _________
setMilliseconds()
document.getElementById("checkboxId").value;
var stringVar = "part 1:" + "part 2";
substring(startIndex, stopIndex)
34. Math object method used to return a random number
Multi line
document.writeln("Text Here") //Advances to new line after text
Math.random() //Returns a value >= 0.0 but <1.0
Either single or double quotes surrounding the data
35. To test that a variable contains a valid number
v
(Condition_Expression) ? Value_If_True : Value_If_False;
var answerVar = confirm("Message Text Here")
isNaN(varHere) //Returns true or false.
36. To get the current value of the control for a text area
var arrayVar = new Array()
Number.NEGATIVE_INFINITY
document.getElementById("textAreaId").value;
f
37. Math object method used to return the highest value from a set of supplied numbers
document.getElementById("TextBoxId").value;
n
Math.max(var1, var2, varN)
v
38. To code a button.onclick event handler
for (counter; condition; incrementor) {}
document.getElementById("ButtonId").onclick = functionName;
if (condition) {}
while (condition) {}
39. To display an alert
isNaN(varHere) //Returns true or false.
alert("Alert Text Here")
standard equality operators
toString(base)
40. What String object method returns a new string containing the value of the original string but in all lower case
toLowerCase()
document.getElementById("TextBoxId").disabled = true;
event handler .
toString(base)
41. The string escape sequence to insert a double quote in JavaScript
document.getElementById("TextBoxId").disabled = true;
var functionName = function(param1, param2, paramN) {}
Math.random() //Returns a value >= 0.0 but <1.0
"
42. To code an If statement in JavaScript
if (condition) {}
document.getElementById("checkboxId").value;
document.getElementById("TextBoxId").disabled = true;
'
43. To assign the value from a prompt to a string
toUpperCase()
toFixed(digits)
concat(var1, var2, varN)
var stringVar = prompt("Text Here")
44. The identity operator for not equal
expression
document.getElementById(id)
toFixed(digits)
!==
45. The format to create a new Date object from a string
Math.max(var1, var2, varN)
indexOf(searchValue, startPosition)
prompt("Text Here")
var dateObject = new Date("11/22/2012 18:25:35")
46. The escape sequence used to insert a Unicode character into a string in JavaScript
for (counter; condition; incrementor) {}
document.getElementById(id)
confirm("Message Text Here")
udddd
47. The syntax of a conditional operator
(Condition_Expression) ? Value_If_True : Value_If_False;
document.getElementById("checkboxId").checked;
window.onload = function() {//actions here}
document.getElementById("ButtonId").onclick = functionName;
48. To assign the return value of confirm() to a variable
indexOf(searchValue, startPosition)
document.getElementById("textAreaId").value;
getFullYear()
var answerVar = confirm("Message Text Here")
49. To display a confirmation
Charset
<noscript>
confirm("Message Text Here")
document.getElementById("textAreaId").value;
50. To concatenate multiple parts into a string
substring(startIndex)
var stringVar = "part 1:" + "part 2";
toUpperCase()
Use the second parameter. Example: prompt("Enter Age:", "18")