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

Functions and Parameters

Multiple Choice Quiz



1

What does the following script display?
<script>
function greet(name){
alert("hello " + name)
}
greet("Shelly")
</script>
A)hello name
B)hello Shelly
C)greet("Shelley")
D)nothing is displayed
2

What does the following script display?
<script>
function greet(name){
alert("hello " + name)
}
</script>
A)hello name
B)hello Shelly
C)greet("Shelley")
D)nothing is displayed
3

What does the following script display?
<script>
function greet(first, last){
alert("hello " + first + last)
}
greet("Shelly ", " Alexander")
</script>
A)hello + first + last
B)hello + Shelly + Alexander
C)hello Shelly Alexander
D)nothing is displayed
4

Given this function definition, which is the correct way to call it?
function sayHello(first, last){
alert("hello " + first + last)
}
A)sayHello("cis", "111")
B)sayHello("cis, 111")
C)sayHello("cis" + "111")
D)none of the above
5

Which is a correct reference to the fourth image object on a web page?
A)document.images[5]
B)document.images(4)
C)document.images[4]
D)document.images{4}
6

The following statements are an example of _____
var up = new Image(), down = new Image()
up.src = up.gif
down.src = down.gif
A)displaying inline images
B)displaying images out-of-line
C)preloading images
D)an image rollover
7

Which statement displays the URL of the initial image on a web page?
A)window.images[0].src
B)document.images[1].src
C)document.images[0].source
D)none of the above
8

Which of the following is recognized by both XHTML and HTML?
A)<img src="stonehengepic.gif" id="stonehenge" />
B)<img src="stonehengepic.gif" name="stonehenge" id="stonehenge.gif" />
C)<img src="stonehengepic.gif" identifier="stonehenge" name="stonehenge" />
D)<img src="stonehengepic.gif" handle="stonehenge" />
9

What will this script display?
<script>
var onSecond = "on first? "
function whose(onFirst){
alert("who's " + onFirst) } // end whose
//call function
whose(onSecond)
</script>
A)who's on first?
B)who's onSecond
C)who?
D)that's right!
10

What will this script display?
<script>
var onSecond = "no, who's on first "
function whose(onFirst){
alert("who's " + onFirst) } // end whose
//call function
whose("onSecond?")
</script>
A)who's onSecond?
B)no, who's on first!
C)who?
D)that's right!




McGraw-Hill/Irwin