Student Center
|
Instructor Center
|
Information Center
|
Home
Sample Code
Choose a Chapter
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Multiple Choice Quiz
True or False
E-Lectures
Feedback
Help Center
Programming the Web Using XHTML and JavaScript
Larry Randles Lagerstrom
Performing Calculations
Multiple Choice Quiz
1
What is displayed by the alert?
var x = 0
x = x + 1
x++
--x
alert(x)
A)
0
B)
1
C)
2
D)
3
2
What is displayed by the alert?
var x = 2, y = 3
x += y
x++
x /= y
alert(x)
A)
0
B)
1
C)
2
D)
none of the above
3
What is displayed by the alert?
var x = 9, y = 2, z = 4
alert(x + y * z)
A)
44
B)
17
C)
924
D)
none of the above
4
What is displayed by the alert?
var x = "9", y = "2", z = "4"
alert(x + y * z)
A)
44
B)
17
C)
924
D)
none of the above
5
Given this function declaration:
function g(){
x = 0
//. . .
}
Which statement is true?
A)
x is a local variable
B)
x is a global variable
C)
both A and B
D)
neither A nor B
6
Given this function declaration:
function g(){
var x = 0
//. . .
}
Which statement is true?
A)
x is a local variable
B)
x is a global variable
C)
both A and B
D)
neither A nor B
7
What does the alert display?
var x = 3
function g(){
var x = 2
alert(x)
}
A)
3
B)
2
C)
x
D)
none of the above
8
What does the alert display?
var x = 3
function g(){
var x = 2
}
alert(x)
A)
3
B)
2
C)
x
D)
none of the above
9
Assume x has not been declared anywhere in the document. What does the alert display?
function g(){
var y = x + 2
alert(y)
}
A)
3
B)
2
C)
y
D)
none of the above
10
What is displayed by the alert when this script is executed?
<script>
function boxofun(x){
return x * x
alert(x * x + " returned")
}
boxofun(5)
</script>
A)
25 returned
B)
x*x returned
C)
5 * 5 returned
D)
none of the above
2003 McGraw-Hill Higher Education
Any use is subject to the
Terms of Use
and
Privacy Policy
.
McGraw-Hill Higher Education
is one of the many fine businesses of
The McGraw-Hill Companies
.