Deck 13: Applets and More

Full screen (f)
exit full mode
Question
Web pages are normally written in

A) Hypertext Markup Language (HTML).
B) Extensible Markup Language (XML).
C) Standard Generalized Markup Language (SGML).
D) Generalized Markup Language (GML).
Use Space or
up arrow
down arrow
to flip the card.
Question
To make a Web page, you create a text file that contains HTML instructions, which are known as ________, as well as the text that should be displayed on the Web page.

A) markups
B) hypertext
C) labels
D) tags
Question
To run an applet, you create an HTML document with a(n) ________ tag.

A) script
B) applet
C) java
D) base
Question
The HTML tag that is used to insert a link has the following general format:

A) Text.
B) Text.
C) Text.
D) Text.
Question
The names of the AWT classes are the same as those of the Swing classes, except the AWT class names do not start with this letter.

A) J
B) X
C) S
D) A
Question
Which of the following is one way to get a reference to the Graphics object for an AWT component or a class that extends JApplet or JFrame?

A) Override the component's paint method.
B) Create a static instance of the Graphics object.
C) Pass an instance of the Graphics object as an argument to the component's constructor.
D) Create an instance of any class that extends the Graphics2D class.
Question
Applets run in a restricted environment to

A) allow the Web browser to communicate with the Web server.
B) prevent malicious code from attacking or spying on unsuspecting users.
C) execute operating system procedures on the user's system.
D) extend the capabilities of a Web page.
Question
Each component has an internal object that inherits from this class, which has numerous methods for drawing graphical shapes on the surface of the component.

A) Frame
B) Graphics
C) Panel
D) Shape
Question
Which of the following statements is correct regarding the line break
, paragraph break

, and horizontal rule


HTML tags.

A) These tags are unique from other tags because they do not occur in pairs.
B) These tags are used to create breaks in an HTML document's text.
C) When you use one of these tags, you insert only an opening tag.
D) All of the above
Question
These are Java programs that are usually part of a Web site.

A) classes
B) applications
C) applets
D) Web services
Question
For all Swing components except JApplet and JFrame, you should override this method to get a reference to the component's Graphics object.

A) paintComponent
B) paint
C) paintBase
D) repaint
Question
An applet class has a method named ________ that performs the same operations as a constructor.

A) init
B) enable
C) add
D) windowInit
Question
Which of the following statements would you write in an HTML document to display the text "History" as a level one header?

A)

History


B) History
C)
History

D) History
Question
When you draw a line or shape on a component, you must indicate its position using these.

A) X and Y coordinates
B) polar coordinates
C) line elements
D) quadrants and octants
Question
An HTML document is usually saved with this file name extension.

A) )xml
B) )html
C) )asp
D) )cfm
Question
An applet class inherits from this class.

A) JWindow
B) JViewport
C) JFrame
D) JApplet
Question
The point where two line segments are connected is called a

A) polygon.
B) cell.
C) vertex.
D) normal.
Question
In addition to displaying standard components such as buttons and labels, Java allows you to draw which of the following?

A) ovals
B) rectangles
C) arcs
D) All of the above
Question
This method draws a string as a graphic.

A) displayString
B) stringDraw
C) paintString
D) drawString
Question
The coordinates of the pixel in the upper-left corner of a component are usually

A) (1, 1).
B) (0, 0).
C) (-1, -1).
D) (100, 100).
Question
Java provides a(n) ________ class for all of the interfaces in the API that have more than one method.

A) converter
B) super
C) adapter
D) general
Question
In HTML, the

tag marks a document's head section, whereas the tag marks a header, which is large bold text.
Question
This method causes the Timer object to start generating action events.

A) start
B) go
C) tick
D) begin
Question
An applet does not have to be on a Web server in order to be executed.
Question
This method clears the surface of the component and then calls the paint method.

A) resurface
B) clear
C) repaint
D) refresh
Question
Once you create a mouse listener class, you can register it with a component using this method, which is inherited from the Component class.

A) addMouseListener
B) getMouseListenerEvent
C) initMouseListener
D) addMouseListenerEvent
Question
The mouse generates two types of events: mouse events and mouse motion events.
Question
When you update the data used to draw shapes on a component, you must call the repaint method to force a call to the paint or paintComponent methods.
Question
If you need to load a sound file to be played multiple times, you should use this object.

A) Album
B) Track
C) SoundByte
D) AudioClip
Question
If you want to make sure that an applet is compatible with all Java-enabled browsers, use AWT components instead of Swing.
Question
A mouse motion listener class must implement the MouseMotionListener interface, which is in this package.

A) javax.swing
B) java.awt.event
C) java.awt
D) java.lang
Question
Instead of displaying its own window, an applet appears in the browser's window.
Question
These classes implement the MouseListener and MouseMotionListener interfaces and provide empty definitions for all of the required methods.

A) MouseAdapter and MouseMotionAdapter
B) MouseTemplate and MouseMotionTemplate
C) MouseInterface and MouseMotionInterface
D) MouseBase and MouseMotionBase
Question
HTML has sophisticated abilities such as performing math calculations and interacting with the user.
Question
Applets are important because they can be used to extend the capabilities of a stand-alone Java application.
Question
The Applet class's ________ method loads a sound file, plays it one time, and then releases it for garbage collection.

A) load
B) play
C) sample
D) getSound
Question
There is no static main method needed to create an instance of the applet class because the browser creates an instance of the class automatically.
Question
A mouse listener class must implement this interface, which is in the java.awt.event package.

A) MouseEvent
B) MouseListener
C) MouseAction
D) MouseInterface
Question
An application can use this object to execute code automatically at regular time intervals.

A) Clock
B) Regulator
C) Meter
D) Timer
Question
A Timer object does not begin generating action events until it is started with a call to its getDelay method.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 13: Applets and More
1
Web pages are normally written in

A) Hypertext Markup Language (HTML).
B) Extensible Markup Language (XML).
C) Standard Generalized Markup Language (SGML).
D) Generalized Markup Language (GML).
A
2
To make a Web page, you create a text file that contains HTML instructions, which are known as ________, as well as the text that should be displayed on the Web page.

A) markups
B) hypertext
C) labels
D) tags
D
3
To run an applet, you create an HTML document with a(n) ________ tag.

A) script
B) applet
C) java
D) base
B
4
The HTML tag that is used to insert a link has the following general format:

A) Text.
B) Text.
C) Text.
D) Text.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
The names of the AWT classes are the same as those of the Swing classes, except the AWT class names do not start with this letter.

A) J
B) X
C) S
D) A
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following is one way to get a reference to the Graphics object for an AWT component or a class that extends JApplet or JFrame?

A) Override the component's paint method.
B) Create a static instance of the Graphics object.
C) Pass an instance of the Graphics object as an argument to the component's constructor.
D) Create an instance of any class that extends the Graphics2D class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
Applets run in a restricted environment to

A) allow the Web browser to communicate with the Web server.
B) prevent malicious code from attacking or spying on unsuspecting users.
C) execute operating system procedures on the user's system.
D) extend the capabilities of a Web page.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
Each component has an internal object that inherits from this class, which has numerous methods for drawing graphical shapes on the surface of the component.

A) Frame
B) Graphics
C) Panel
D) Shape
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following statements is correct regarding the line break
, paragraph break

, and horizontal rule


HTML tags.

A) These tags are unique from other tags because they do not occur in pairs.
B) These tags are used to create breaks in an HTML document's text.
C) When you use one of these tags, you insert only an opening tag.
D) All of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
These are Java programs that are usually part of a Web site.

A) classes
B) applications
C) applets
D) Web services
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
For all Swing components except JApplet and JFrame, you should override this method to get a reference to the component's Graphics object.

A) paintComponent
B) paint
C) paintBase
D) repaint
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
An applet class has a method named ________ that performs the same operations as a constructor.

A) init
B) enable
C) add
D) windowInit
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following statements would you write in an HTML document to display the text "History" as a level one header?

A)

History


B) History
C)
History

D) History
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
When you draw a line or shape on a component, you must indicate its position using these.

A) X and Y coordinates
B) polar coordinates
C) line elements
D) quadrants and octants
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
An HTML document is usually saved with this file name extension.

A) )xml
B) )html
C) )asp
D) )cfm
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
An applet class inherits from this class.

A) JWindow
B) JViewport
C) JFrame
D) JApplet
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
The point where two line segments are connected is called a

A) polygon.
B) cell.
C) vertex.
D) normal.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
In addition to displaying standard components such as buttons and labels, Java allows you to draw which of the following?

A) ovals
B) rectangles
C) arcs
D) All of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
This method draws a string as a graphic.

A) displayString
B) stringDraw
C) paintString
D) drawString
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
The coordinates of the pixel in the upper-left corner of a component are usually

A) (1, 1).
B) (0, 0).
C) (-1, -1).
D) (100, 100).
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Java provides a(n) ________ class for all of the interfaces in the API that have more than one method.

A) converter
B) super
C) adapter
D) general
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
In HTML, the

tag marks a document's head section, whereas the tag marks a header, which is large bold text.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
This method causes the Timer object to start generating action events.

A) start
B) go
C) tick
D) begin
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
An applet does not have to be on a Web server in order to be executed.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
This method clears the surface of the component and then calls the paint method.

A) resurface
B) clear
C) repaint
D) refresh
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
Once you create a mouse listener class, you can register it with a component using this method, which is inherited from the Component class.

A) addMouseListener
B) getMouseListenerEvent
C) initMouseListener
D) addMouseListenerEvent
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
The mouse generates two types of events: mouse events and mouse motion events.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
When you update the data used to draw shapes on a component, you must call the repaint method to force a call to the paint or paintComponent methods.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
If you need to load a sound file to be played multiple times, you should use this object.

A) Album
B) Track
C) SoundByte
D) AudioClip
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
If you want to make sure that an applet is compatible with all Java-enabled browsers, use AWT components instead of Swing.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
A mouse motion listener class must implement the MouseMotionListener interface, which is in this package.

A) javax.swing
B) java.awt.event
C) java.awt
D) java.lang
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
Instead of displaying its own window, an applet appears in the browser's window.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
These classes implement the MouseListener and MouseMotionListener interfaces and provide empty definitions for all of the required methods.

A) MouseAdapter and MouseMotionAdapter
B) MouseTemplate and MouseMotionTemplate
C) MouseInterface and MouseMotionInterface
D) MouseBase and MouseMotionBase
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
HTML has sophisticated abilities such as performing math calculations and interacting with the user.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
Applets are important because they can be used to extend the capabilities of a stand-alone Java application.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
The Applet class's ________ method loads a sound file, plays it one time, and then releases it for garbage collection.

A) load
B) play
C) sample
D) getSound
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
There is no static main method needed to create an instance of the applet class because the browser creates an instance of the class automatically.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
A mouse listener class must implement this interface, which is in the java.awt.event package.

A) MouseEvent
B) MouseListener
C) MouseAction
D) MouseInterface
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
An application can use this object to execute code automatically at regular time intervals.

A) Clock
B) Regulator
C) Meter
D) Timer
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
A Timer object does not begin generating action events until it is started with a call to its getDelay method.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 40 flashcards in this deck.