Developed by Y. Daniel Liang using Java Servlets (Current time is Sat Nov 21 19:55:12 EST 2009)

The questions are to accompany Introduction to Java Programming, 4E by Y. Daniel Liang. Please report errors to y.daniel.liang@gmail.com.

Introduction to Java Programming, 4E has been superseded by Introduction to Java Programming, 5E.

Chapter 16: Multimedia

Section 16.2 Playing Audio
1   To play an audio file named audiofile.au, you can use __________.

A. play("audiofile.au", url)
B. play(url, "audiofile.au")
C. play("audiofile.au")
D. play(url+"audiofile.au")

2   To create an audio clip for a file named audiofile.au, you use __________.

A. getAudioClip ("audiofile.au", url)
B. getAudioClip (url, "audiofile.au")
C. getAudioClip ("audiofile.au")
D. getAudioClip (url+"audiofile.au")

3   To repeatedly play an instance of audio clip ac, you use __________.

A. ac.loop()
B. ac.repeat()
C. ac.repeating()
D. ac.continue()

4   To get the URL of the applet, you use __________.

A. getCodeBase()
B. getDocumentBase()
C. returnCodeBase()
D. returnDocumentBase()

Section 16.4 Displaying Images
5   To get the image file at a specified URL, you use __________.

A. getImage(url)
B. createImage(url)
C. url.getImage()
D. url.createImage()

6   To draw the image im to fill in the whole viewing area, you use __________.

A. drawImage(im, 10, 10)
B. drawImage(im, 0, 0, getSize().width, getSize().height)
C. drawImage(im, 0, 0, this)
D. drawImage(im)

Section 16.5 Loading Image and Audio Files in Java Applications
7   To get the image file imagefile.gif in a Java application, you use __________.

A.  
Toolkit kt = new Toolkit();
Image image = tk.getImage("imagefile.gif");

B.
Toolkit kt = Toolkit.getDefaultToolkit();
Image image = tk.getImage("imagefile.gif");

C.  
Toolkit kt = Toolkit.getCurrentToolkit();
Image image = tk.getImage("imagefile.gif");

D.  
Image image = Toolkit.getImage("imagefile.gif");


Section 16.7 Using MediaTracker
8   To add an image im to a media tracker mt, you use __________.

A. mt.add(im, id)
B. mt.addItem(im, id)
C. mt.addImage(im, id)
D. mt.putImage(im, id)

9   To dispose of a media tracker object mt, you use __________.
A. mt.dispose()
B. mt.null();
C. mt = null
D. mt.destroy();