McGraw-Hill OnlineMcGraw-Hill Higher EducationLearning Center
Student Center | Instructor Center | Information Center | Home
Sample Code
Multiple Choice Quiz
True or False
E-Lectures
Feedback
Help Center


Programming the Web Using XHTML and JavaScript
Larry Randles Lagerstrom

Putting It All Together: Online Quizzes and Slide Shows

Multiple Choice Quiz



1

Which increments a variable named sum by 1?
A)sum = sum + 1
B)sum++
C)sum += 1
D)all of the above
2

Which decrements a variable named sum by 1?
A)sum = sum - 1
B)--sum
C)sum--
D)all of the above
3

Which tests to see whether the browser recognizes Image objects?
A)browser.version >= 3
B)Navigator.appversion >= 3
C)document.images == true
D)Images == true
4

Suppose a web page includes a form named f with a text field named t1. Which of these statements converts the text enteredin t1 by the user to all lowercase letters and displays it in t1?
A)document.f.t1 = document.f.t1.toLowerCase()
B)var lcString = document.f.t1.toLower()
C)document.f.t1.value = document.f.t1.value.toLowerCase()
D)document.f.t1.value.toLowerCase()
5

Suppose a web page includes a form named f with a text field named t1. Which of these statements converts the text enteredin t1 by the user to all lowercase letters and checks whether it has the value "BULLWINKLE"?
A)if(document.f.t1.value.toUpperCase() == "BULLWINKLE") …
B)if(document.f.t1toUpperCase() == "BULLWINKLE") …
C)if(document.f.t1.value.touppercase() == "BULLWINKLE") …
D)if(document.f.t1.value.toUpperCase() == BULLWINKLE.toString()) …
6

Which statement executes the alert every 3 seconds?
A)TimeOut("alert('wake up!')", 3)
B)setTimeout('alert("wake up!")', 3000)
C)callTimeout("alert('wake up!')", 3000)
D)setTimeOut(alert("wake up!"), 9000/3)
7

Which tests to see whether the browser recognizes Image objects?
A)Navigator.appversion >= 3
B)document.images
C)document.images == true
D)both B and C
8

Which of the following event handlers calls the function named flyingSquirrel when the browser finishes loading the page?
A)loadComplete=" flyingSquirrel('RocketJ')"
B)onload="flyingSquirrel('RocketJ')"
C)onload='flyingSquirrel("RocketJ")'
D)both B and C
9

Which of the following function return statements is syntactically correct?
A)return 12
B)return 12; exit
C)exit; return 12
D)none of the above
10

What is a better name for this function?
function mystery(n){
return n * n
}
A)sqrt
B)cube
C)square
D)double




McGraw-Hill/Irwin