Lab 6
- Applets & Applications
Post
Test
1. Which of the following is not a standard method used in applet programming?
2. What are the main differences between a Java applet and a Java application?
a. I b. I & II c. II & III d. I, III, & IV
a. java.applet.Applet
b. java.util
c. java.java
d. java.awt.*
Answer: A
4. What are the appropriate uses for an applet?
I. Designing Web pages.
II. Running server side application.
III. Running client side application.
IV. Making a secure connection to a server.
a. II b. I & II c. I, II & III d. I & III
Answer: D
5. Given that an Applet contains three methods: init(), paint() and start(). Which method will be invoked first?
Answer: A
Comprehension:
6. An Applet can throw an exception.
Answer: A
7. Which of the following
statements is true?
I. The browser acts the main() method and the applet provides methods for the browser.
II. Unlike
a Java application, a Java applet cannot be compiled because it does not
contain a main() method.
III. Applets are intended to be
included in HTML pages.
IV. Using
the <APPLETVIEWER> tag, you specify (at a minimum) the location of the
Applet subclass and the dimensions of the applet’s onscreen display area.
a.
I, II,
III, & IV b. I & II c. I, II, & III d. I & III
Answer: D
8. Given the following HTML code, which portion of the <APPLET> tag must be changed if we change the location of the Applet class file?
<APPLET CODE="HelloApplet.class"
WIDTH=500
HEIGHT=500
CODEBASE=".">
</APPLET>
Answer: B
9. Suppose you are a programmer for a company and have been asked to build a system for a particular task. Your client wants to know whether to use an applet or an application. What questions should you ask?
I. Will the system be used within a browser?
II. Will the system be an interactive system with a graphical user interface?
III. Will the system require dynamic and flexible information dissemination on the Internet?
IV. Will the system require read/write access to files on the local computer?
a. I & II b. II & III c. I, II, & III d. I, II, III, & IV e. II, III, & IV
Answer: D
10. Given the following code:
public class HelloApplet extends
java.applet.Applet
{
public void paint(java.awt.Graphics g)
{
g.drawString("Hello World Applet!", 20, 20);
}
}
If we change the line
g.drawString("Hello
World Applet!", 20, 20);
to
g.drawString("Hello
World Applet!", 200, 200);
What changes
will be reflected in the output when you run this modified Applet?
Answer: A