1) Which of the following does not run in the context of another
program
a) stand-alone applications
b) an applet
c) a servlet
d) an enterprise java
bean
( a )
a ) code
b) width
c) height
d)
codebase
( d )
3) Mark the method that is not one of the standard methods overridden in an applet.
a) init( )
b) start( )
c) run( )
d) stop( )
e) paint(
)
( c )
4) Which of the following lines is not correct in the following applet?
a) import java.awt.*;
b) import java.awt.applet.*;
c) public ThisApplet extends Applet {
d) public void paint( Graphics g){ g.drawString("Hi!", 10, 10 );
}
}
( b )
// This
points to the fact that early in Java's history Applets were
// the only
'show in town' and had their own package. The correct
// import
would be 'import java.applet.*; Note the newer JApplet
// is
dovetailed into the swing package.
5) The appletviewer utility
a) facilitates quick viewing of applets during
development
b) requires as an argument a class file just as is passed to the 'java'
command
c) can run an html file or a java source file
d) to run an applet from source file the applet tag must be supplied
and
commented
out.
( b )
// appletviewer
needs something that acts as a document that in turn
// points to where a class file is
6) True or False: Because the init( ) method of an applet acts like a
constructor, constructors cannot be used with applets. (
False )
// We
didn't cover this and is also just for your information. Applets
// are in
everyway normal classes, so constructors can be used with
// them like
other classses, ( excepting anomolies like the Math class.)
a) init( )
b) start( )
c) paint( )
d) stop(
)
( a )