Multiple Choice
Identify the
letter of the choice that best answers the question.
|
| 1. | Which
XHTML tag includes JavaScript code as its content? a. | <code> | b. | <script> | c. | <javascript> | d. | <jscript> | | |
|
| 2. | Which
of the following JavaScript snippets is a single assignment statement? a. | x = new Assignment( ); | b. | document.write(assignment); | c. | if(assignment ==
homework) | d. | for(i=0; i<assignment; i++) | | |
|
| 3. | Which
of the following JavaScript snippets is a function call? a. | x = function; | b. | document.write(function); | c. | if(function == call) | d. | for (i=0; i<function;
i++) | | |
|
| 4. | Which
code snippet does NOT change the contents of the Web page? a. | document.write(new
contents); | b. | element.innerHTML = new
contents; | c. | img_element.src =
new_filename.jpg; | d. | element.contents = new
contents; | | |
|
| 5. | Which
of the following is a benefit of using code repositories? a. | documented
code | b. | well-written
code | c. | ready-to-use
code | d. | tested
code | | |
|
| 6. | How
would you rate your time management in this class?
(Consider
working through the period, turning things in on time, distractions, etc.) a. | Poor | b. | Ok | c. | Good | d. | Excellent | | |
|
| 7. | Look
at the following code snippet. If you wanted to greet your Web site visitors specifically in the
evening, which line would you change?
var d = new Date( );
var h =
d.getHours( );
if (h<12) document.write(Good
morning!);
else document.write(Hello!);
a. | Line 1 | c. | Line 3 | b. | Line
2 | d. | Line
4 | | | | |
|
| 8. | Use
the documentation below to help you with the following question.
What happens if you use this code
snippet?
var a = 5;
var b =
2;
var x = Math.max(Math.random( ), Math.pow(a,b));
a. | The value of x is a random
number between 0 and 1 | b. | The value of x is a random
number between a and b. | c. | The value of x is 25 | d. | The value of x is 5 | | |
|
Short Answer
|
| 9. | Explain your choice for question #7, or re-write the line you would
change.
|