You are on page 1of 10

Atmiya Institute of Technology and Science for Diploma Studies, Rajkot

Computer Engineering Department

Faculty Name: Bhumika S. Zalavadia


Semester & Class: VI – BX, BY
Subject Name & Code: Advance Java Programming (3360701)

Chapter-1 Applet Programming

(1) Which method is called only once during the run time of applet?
a.stop()
b. init()
c. stat()
d. destroy()
(2) Which is a required attribute that gives the name of the file containing your applet’s compiled .class file?
a.codebase
b.codeclass
c. codename
d. code
(3) Which are the common security restrictions in applets?
a. Applets can't load libraries or define native methods.
b. An applet can't read every system property.
c. Applets can play sounds.
d. Both A & B
(4) From the following statements which is a drawback for Applet?
a. It works at client side so less response time
b. Most of the web browsers support applets.
c. It can be executed by browsers running under many platforms, including Linux, Windows, and Mac Os
etc.
d. Plugin is required at client browser to execute applet
(5) Applet works at client side so less response time.
a. True
b. False
c. May be
(6) The APPLET tag is used to start an applet from both an HTML document and from an applet viewer.
a. True
b. False
(7) What invokes immediately after the start() method and also any time the applet needs to repaint itself in the
browser?
a.stop()
b. init()
c. paint()
d. destroy()
(8) When an applet is terminated which of the following sequence of methods calls take place?
a. stop(),paint(),destroy()
b. destroy(),stop(),paint()
c. destroy(),stop()
d. stop(),destroy()
(9) Applet runs inside the browser and does not work at client side.
a. True
b. False
c. May be
(10) Which is a special type of program that is embedded in the webpage to generate the dynamic content?
a. Package
b. Applet
c. Browser
d. None of the above
(11) What is used to run an Applet?
a. An html file
b. An AppletViewer tool(for testing purpose)
c. Both A & B
d. None of the above
(12) Which is the correct order of lifecycle in an applet?
a. Applet is started, initialized, painted, destroyed, stopped
b. Applet is painted, started, stopped, initilaized, destroyed
c. Applet is initialized, started, painted, stopped, destroyed
d. None of the above
(13) Java Plug-in software is not responsible to manage the lifecycle of an Applet.
a. True
b. False
c. May be
(14) Which method is used to suspend threads that don’t need to run when the applet is not visible?
a. destroy()
b. paint()
c. stop()
d. start()
(15) All Applets must import java.applet and java.awt.
a. True
b. False
(16) Which of the following methods is provided by java.awt.component class?
a. public void paint(Graphics g)
b. public void destroy()
c. public void stop()
d. public void init()
(17) Which method is invoked when browser is maximized?
a. public void start()
b. public void paint(Graphics g)
c. Public void stop()
d. Public void init()
(18) Which of these functions is called to display the output of an applet?
a. display()
b. paint()
c.displayApplet()
d.PrintApplet()
(19) Which of these methods can be used to output a string in an applet?
a. display()
b. print()
c.drawString()
d. transient()
(20) What is the Message is displayed in the applet made by the following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet, 20, 20);
}
}
a Simple Applet
b. A Simple Applet 20 20
c. Compilation Error
d. Runtime Error
(21) What is the output of following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
Graphic g;
g.drawString("A Simple Applet", 20, 20);
}
a Simple Applet
b. A Simple Applet 20 20
c. Compilation Error
d. Runtime Error
(22) Arrange the steps involved in developing and testing the applet in correct order.
i) creating an executable applet (.classfile)
ii) preparing <APPLET> tag
iii) creating HTML file
iv) building an applet code (.java file)
v) testing the applet code

a. 1-i, 2-ii, 3-iii, 4-iv, 5-v


b. 1-ii, 2-iii, 3-iv, 4-v, 5-i
c. 1-iv, 2-i, 3-ii, 4-iii, 5-v
d. 1-iii, 2-iv, 3-v, 4-i, 5-ii
(23) State whether the following statements about the Applets are True or False.
i) Applets can communicate with other services on the network.
ii) Applets cannot run any program from the local computer.

a. True, False
b. False, True
c. True, True
d. False, False

(24) Applet class is a subclass of the panel class, which is again a subclass of the ………………….. class.
a. object
b. component
c. awt
d. container
(25) The ………………method is called every time the applet receives focus.
a. init( )
b. start( )
c. stop( )
d. destroy( )
(26) Which of the following applet tags is correct to embed an applet class named Test into a webpage?

a. <applet class=Test width=200 height=100></applet>


b. <applet>code=Test.class width=200 height=100></applet>
c. <applet code=”Test.class” width=200 height=100></applet>
d. <applet param=Test.class width=200 height=100></applet>
(27) The …………………. class is an abstract class that represents the display area of the applet.
a. display
b. graphics
c. text
d. area
(28) The graphics class provides methods to draw a number of graphical figure including
i) Text ii) Lines iii) Images iv) Ellipse
a. i, ii and iii only
b. ii, iii and iv only
c. i, iii and iv only
d. All i, ii, iii and iv
(29) The ………………. method is called to clear the screen and calls the paint( ) method.
a. update( )
b. paint( )
c. repaint( )
d. reupdate( )
(30) The ………………….. method is automatically called the first time the applet is displayed on the screen and
every time the applet receives focus.
a. update( )
b. paint( )
c. repaint( )
d. reupdate( )
(31) The ………………. method is defined by the AWT which causes the AWT runtime system to execute a call
to your applet’s update( ) method.
a. update( )
b. paint( )
c. repaint( )
d. reupdate( )
(32) In java applet, we can display numerical values by first converting them into string and then using the ………
method.
a. paint( )
b. drawstring( )
c. draw( )
d. convert( )
(33) We can change the text to be displayed by an applet by supplying new text to be displayed by an applet by
supplying new text to the applet through a ……………………… tag.
a. <EDIT>
b. <CHANGE>
c. <REPLACE>
d. <PARAM>
(34) Which of the following is/are the possible values for alignment attribute of Applet tag.
i) Top ii) Left iii) Middle iv) Baseline

a. i, ii and iii only


b. ii, iii and iv only
c. i, iii and iv only
d. All i, ii, iii and iv
(35) The ……………….. attribute of applet tag specifies the amount of horizontal blank space the browser should
leave surrounding the applet.
a. SPACE=pixels
b. HSPACE=piexls
c. HWIDTH=piexls
d. HBLANK=pixels
(36) Which of the following method is not defined by Applet class?
a. init( )
b. start( )
c. stop( )
d. paint( )
(37) What is not true about applet?
a. Applet do not have main().
b. Applet should be run under java compatible web brwoser.
c. Applet runs on client side.
d. <applet> tag is supported by HTML5.
(38) The base class of Button class is……………
a. Component
b. Label
c. Objects
d. Container
(39) Which is a required attribute that gives the name of the file containing your applet’s compiled .class file?
a. CODE
a. CODEBASE
b. ALT
c. NAME
(40) Applet works at client side so less response time.
a. True
b. False
(41) Which Invoked immediately after the start() method, and also any time the applet needs to repaint itself in the
browser?
a. stop()
b. init()
c. paint()
d. destroy()
(42) An applet can play an audio file represented by the AudioClip interface in the java.applet package. The
AudioClip interface has how many methods?
a. 2
b. 3
c. 1
d. 4

(43) An applet can play an audio file represented by the AudioClip interface in the java,applet package Causes the
audio clip to replay continually in which method?
a. public void play()
b. public void loop()
c. public void stop()
d. None of the above
(44) Applets cannot make network connection exception to the server host from which it originated?
a. True
b. False
(45) AppletViewer tool is available in which of the folder of JDK?
a. bin
b. lib
c. source
d. class
(46) The Applet class is in ………..package
a. java.applet
b. java.awt
c. java.io
d. java.util
(47) To run an applet……….command is used.
a. run
b. java
c. appletviewer
d. applet

(48) which of the following is an optional attribute of applet tag?


a. Code
b. Name
c. Width
d. Height
(49) To display text in the applet status bar………method is used.
a. showStatus()
b. showStatusBar()
c. drawStatus()
d. drawStatusBar()
(50) which method can be used to draw a circle in the applet?
a. drawCircle()
b. drawOval()
c. drawArc()
d. both b and c
(51) which package contains color class?
a. java.applet
b. java.awt
c. java.graphics
d. java.lang
(52) Which class is used to get dimensions of an applet?
a. Dimension
b. Metrics
c. Applet
d. fontMetrics
(53) The constructor for Font class is…………….
a. Font(String name)
b. Font(string name,int style,int size)
c. Font(String name,int size)
d. Font(String name,int style)
(54) The syntax of paint() method is…………….
a. public void paint()
b. public void paint(String s)
c. public void paint(Graphics g)
d. public void paint(Graphics g,String s)

(55) The(0,0) coordinates of applet window is located at……


a. at the center of the applet
b. at the center of the right edge of the applet
c. at the center of the left edge of the applet
d. at the upper-left corner of the applet

(56) Executable applet is…………


a. .applet file
b. .java html
c. .java file
d. .class file
(57) Which of the following attributes are compulsory in <applet> tag?
a. Code
b. Name
c. Width
d. All of Above
(58) Which of the following is method of Applet class?
a. resize()
b. showStatus()
c. getDocumentBase()
d. All of Above
(59) Which of the followings is false for Applet?
a. Applet can work with native methods.
b. It requires the Java plug-in, which isn't available on all web browsers by default.
c. Some browsers like mobile browsers running IOS or Android do not support Java applets at all.
d. Applets don’t access client-side resources like Files.

(60) Which class provides many methods for graphics programming?


a. java.awt
b. java.Graphics
c. java.awt.Graphics
d. None of the above
(61) When we invoke repaint() for a java.awt.Component object, the AWT invokes the method………..
a. draw()
b. show()
c. update()
d. paint()
(62) Package of drawOval() method is…..
a. java.applet
b. java.io
c. javax.swing
d. java.awt

**************************

You might also like