Deck 14: Applets and More
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/39
Play
Full screen (f)
Deck 14: Applets and More
1
Given the following code,how many times per second will the TimerListener event be generated? Timer timer = new Timer(1000,new TimerListener());
A) 1
B) 10
C) 100
D) 1000
A) 1
B) 10
C) 100
D) 1000
A
2
Which of the following sound file formats does Java not support?
A) .wav
B) .au
C) .mid
D) Java supports all of the above
A) .wav
B) .au
C) .mid
D) Java supports all of the above
D
3
These are Java programs that are usually part of a Web site.
A) Applications
B) Applets
C) Classes
D) Web services
A) Applications
B) Applets
C) Classes
D) Web services
B
4
A mouse motion listener class can respond to:
A) The mouse button is clicked on
B) The mouse cursor exits a component's screen space
C) The mouse moved
D) The mouse button is released
A) The mouse button is clicked on
B) The mouse cursor exits a component's screen space
C) The mouse moved
D) The mouse button is released
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
5
When the applet viewer opens an HTML document with more than one < APPLET > tag,
A) it terminates immediately.
B) it displays the first applet,and then terminates.
C) it displays each applet in a separate window.
D) it displays each applet in order in the same window.
A) it terminates immediately.
B) it displays the first applet,and then terminates.
C) it displays each applet in a separate window.
D) it displays each applet in order in the same window.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
6
What does the tag < p > cause to happen?
A) A double space
B) A paragraph break
C) Indentation for a paragraph
D) Plain text to be displayed
A) A double space
B) A paragraph break
C) Indentation for a paragraph
D) Plain text to be displayed
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is not a restriction placed on applets?
A) Applets cannot create files on the user's system.
B) Applets cannot execute operating system procedures on the user's system.
C) Applets cannot display a window.
D) Applets cannot retrieve the user's identity.
A) Applets cannot create files on the user's system.
B) Applets cannot execute operating system procedures on the user's system.
C) Applets cannot display a window.
D) Applets cannot retrieve the user's identity.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
8
If a frame component is 200 pixels wide and 300 pixels high,the lower,left-hand corner has (X,Y)coordinates of
A) (0,299)
B) (0,300)
C) (200,0)
D) (0,0)
A) (0,299)
B) (0,300)
C) (200,0)
D) (0,0)
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following is not a valid AWT class?
A) Panel
B) Applet
C) TextArea
D) JMenu
A) Panel
B) Applet
C) TextArea
D) JMenu
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
10
In an HTML document,the tags
A) instruct the Web browser how to format the text.
B) instruct the Web browser where to place images.
C) instruct the Web browser what to do when the user clicks on a link.
D) All of the above
A) instruct the Web browser how to format the text.
B) instruct the Web browser where to place images.
C) instruct the Web browser what to do when the user clicks on a link.
D) All of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
11
Hypertext can contain
A) a Java application program
B) exception methods
C) executable code
D) a link to another Web page
A) a Java application program
B) exception methods
C) executable code
D) a link to another Web page
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
12
Which tag will produce largest text?
A) < h4 >Hello< /h4 >
B) < h3 >Hello< /h3 >
C) < h2 >Hello< /h2 >
D) < h1 >Hello< /h1 >
A) < h4 >Hello< /h4 >
B) < h3 >Hello< /h3 >
C) < h2 >Hello< /h2 >
D) < h1 >Hello< /h1 >
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
13
Certain restrictions are placed on applets.If an applet attempts to violate one of these restrictions,
A) the program has a fatal error.
B) it will display a window stating that it has violated the restriction.
C) an exception is thrown.
D) it automatically notifies the Web server of the violation.
A) the program has a fatal error.
B) it will display a window stating that it has violated the restriction.
C) an exception is thrown.
D) it automatically notifies the Web server of the violation.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
14
Applets are important because the can be used to
A) extend the capabilities of a web page.
B) process large data files.
C) run other programs on the user's system.
D) keep the doctor away.
A) extend the capabilities of a web page.
B) process large data files.
C) run other programs on the user's system.
D) keep the doctor away.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
15
An applet using a Swing GUI extends which class?
A) Applet
B) JApplet
C) JSwing
D) JFrame
A) Applet
B) JApplet
C) JSwing
D) JFrame
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following will load the applet,TestApplet?
A) < applet code="TestApplet.class" width=200 height=50 >< /applet >
B) < applet code=TestApplet.class width=200 height=50 >< /applet >
C) < load code="TestApplet.class" width=200 height=50 >< /load >
D) < load code=TestApplet.class width=200 height=50 >< /load >
A) < applet code="TestApplet.class" width=200 height=50 >< /applet >
B) < applet code=TestApplet.class width=200 height=50 >< /applet >
C) < load code="TestApplet.class" width=200 height=50 >< /load >
D) < load code=TestApplet.class width=200 height=50 >< /load >
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
17
When you extend an interface,you must implement all the methods defined in the interface.If you are interested in only one or two mouse events,you can extend the _______ class which implements the MouseListener interface,but does not require you to write all the functions in the interface.
A) MouseAdapter
B) MouseExtender
C) MouseMotionAdapter
D) MouseMotionExtender
A) MouseAdapter
B) MouseExtender
C) MouseMotionAdapter
D) MouseMotionExtender
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
18
What does the HTML tag < hr > cause to happen?
A) A header routine is created.
B) A horizontal line will be displayed.
C) A default header reference will be linked to.
D) The window will be blanked out before the remainder of the text is displayed.
A) A header routine is created.
B) A horizontal line will be displayed.
C) A default header reference will be linked to.
D) The window will be blanked out before the remainder of the text is displayed.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
19
In the link produced by the following HTML,what word would you click to go to the linked location? Click here to learn more about
< a href="http://www.applications.com" >applications.< /a >
A) Click
B) here
C) Click here to learn more about
D) applications
< a href="http://www.applications.com" >applications.< /a >
A) Click
B) here
C) Click here to learn more about
D) applications
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
20
In the following code,which line has an error? 1 public class TestApplet extends JApplet
2 {
3 public void init()
4 {
5 super.JApplet();
6 JLabel label = new JLabel("Test label");
7 setLayout(new FlowLayout());
8 add(label);
9 }
10 }
A) 1
B) 3
C) 5
D) There are no errors
2 {
3 public void init()
4 {
5 super.JApplet();
6 JLabel label = new JLabel("Test label");
7 setLayout(new FlowLayout());
8 add(label);
9 }
10 }
A) 1
B) 3
C) 5
D) There are no errors
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
21
The play method will load and play a sound file once,then release it for garbage collection.The getAudioClip method will load the sound file and may assign the location of the sound file to a variable so it may be invoked many times.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
22
Some browsers do not directly support the Swing classes of applets.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
23
In an applet,events are handled
A) with special applet event listeners.
B) differently,depending upon which computer is running the applet.
C) with event listeners exactly as they are in GUI applications.
D) by always terminating the applet.
A) with special applet event listeners.
B) differently,depending upon which computer is running the applet.
C) with event listeners exactly as they are in GUI applications.
D) by always terminating the applet.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
24
In the following code,what does getDocumentBase()return? play(getDocumentBase(),"mysound.wav");
A) A URL object containing the location of the applet's .class file
B) A URL object containing the location of the HTML file that invoked the applet
C) The HTML location "mysound.wav"
D) The sound file itself
A) A URL object containing the location of the applet's .class file
B) A URL object containing the location of the HTML file that invoked the applet
C) The HTML location "mysound.wav"
D) The sound file itself
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
25
The Applet class requires that you write a constructor to create an object of the class.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
26
For all Swing components except JApplet and JFrame,you should override the paintComponent method instead of the paint method.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
27
In the following code that uses a Swing GUI,which line has an error? 1 public class TestApplet extends Applet
2 {
3 public void init()
4 {
5 JLabel label = new JLabel("Test label");
6 setLayout(new FlowLayout());
7 add(label);
8 }
9 }
A) 1
B) 3
C) 5
D) There are no errors
2 {
3 public void init()
4 {
5 JLabel label = new JLabel("Test label");
6 setLayout(new FlowLayout());
7 add(label);
8 }
9 }
A) 1
B) 3
C) 5
D) There are no errors
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
28
The delay parameter in the Timer constructor is the amount of time between action events,measured in milliseconds.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
29
Given the following code,how many times per second will the TimerListener event be generated? Timer timer = new Timer(500,new TimerListener());
A) 5
B) 50
C) 2
D) 500
A) 5
B) 50
C) 2
D) 500
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
30
The browser creates an instance of the applet class automatically.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
31
Everything that appears between these tags in an HTML document is the content of the Web page.
A) < head > and < /head >
B) < html > and < /html >
C) < doc > and < /doc >
D) < content > and < /content >
A) < head > and < /head >
B) < html > and < /html >
C) < doc > and < /doc >
D) < content > and < /content >
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
32
One way of viewing the results of the applet which is invoked in the HTML document TestApplet.html,is to enter the following at the command prompt.
A) appletviewer TestApplet.html
B) appleviewer TestApplet
C) viewapplet TestApplet.html
D) view TestApplet
A) appletviewer TestApplet.html
B) appleviewer TestApplet
C) viewapplet TestApplet.html
D) view TestApplet
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
33
The following getAudioClip()method returns an object that will load the sound file and assign the location of that file to clip which can then be used to call methods that may play the sound file one or more times:
Audioclip clip = getAudioClip(getDocumentBase(),"mysound.wav");
Audioclip clip = getAudioClip(getDocumentBase(),"mysound.wav");
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
34
An applet using a Swing GUI is extended from this class.
A) JFrame
B) JLabel
C) JSwing
D) JApplet
A) JFrame
B) JLabel
C) JSwing
D) JApplet
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
35
If you want to make sure that an applet is compatible with all Java-enabled browsers,use Swing components instead of AWT.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
36
If a frame component is 300 pixels wide and 200 pixels high,the upper,right-hand corner has (X,Y)coordinates of
A) (0,0)
B) (300,0)
C) (200,300)
D) (299,0)
A) (0,0)
B) (300,0)
C) (200,300)
D) (299,0)
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
37
Whenever you need a component of any type to be painted,call the paint method.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following can a mouse listener respond to?
A) The mouse button is pressed
B) The mouse button is clicked
C) The mouse cursor enters a component's screen space
D) All of the above
A) The mouse button is pressed
B) The mouse button is clicked
C) The mouse cursor enters a component's screen space
D) All of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
39
The delay parameter in the Timer constructor is the amount of time between action events,measured in microseconds.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck