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