You are on page 1of 4

1)  

Which of these methods are used to register a mouse motion listener?


a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()
2). How constructor can be used for a servlet?
a) Initialization
b) Constructor function
c) Initialization and Constructor function
d) Setup() method
2) Which method is called only once during the run time of your applet?
a. stop()
b. paint()
c. init()
d. destroy()
3). What is the difference between servlets and applets?
i. Servlets execute on Server; Applets execute on browser
ii. Servlets have no GUI; Applet has GUI
iii. Servlets creates static web pages; Applets creates dynamic web pages
iv. Servlets can handle only a single request; Applet can handle multiple requests
a) i, ii, iii are correct b) i, ii are correct
c) i, iii are correct d) i, ii, iii, iv are correct
4).Which of the following is true about servlets?
a) Servlets execute within the address space of web server
b) Servlets are platform-independent because they are written in java
c) Servlets can use the full functionality of the Java class libraries
d) Servlets execute within the address space of web server, platform independent and uses the functionality of java
class libraries
5).Which method executes only once
a.start() method
b. init() method
c. stop() method
d.destroy() method

6) Which is a special type of program that is embedded in the webpage to generate dynamic
content?
a. Package
b. Applet
c. Browser
d. None of the above
7) All Applets must import java.applet and java.awt.
a. True
b. False
8)Suppose you are developing a Java Swing application and want to toggle between various views of the design
area. Which of the views given below are present for the users to toggle?
a.Design View
b.Requirements View
c.Source View
d.Management View
9) Where are the following four methods commonly used?
1) public void add(Component c)
2) public void setSize(int width,int height)
3) public void setLayout(LayoutManager m)
4) public void setVisible(boolean)
a. Graphics class
b. Component class
c. Both A & B
d. None of the above
10)Implement the Listener interface and overrides its methods is required to perform in event
handling.
a. True
b. False
11)Which is the container that doesn't contain title bar and MenuBars but it can have other
components like button, textfield etc?
a. Window
b. Frame
c. Panel
d. Container
12) Which object can be constructed to show any number of choices in the visible window?
a. Labels
b. Choice
c. List
d. Checkbox
13)   In Graphics class which method is used to draws a rectangle with the specified width and height?

a. public void drawRect(int x, int y, int width, int height)


b. public abstract void fillRect(int x, int y, int width, int height)
c. public abstract void drawLine(int x1, int y1, int x2, int y2)
d. public abstract void drawOval(int x, int y, int width, int height)

14)Which method can set or change the text in a Label?


a. setText()
b. getText()
c. All the above
d. None of the above
15)   In Servlet Terminology what provides runtime environment for JavaEE (j2ee) applications. It performs
many operations that are given below:

1. Life Cycle Management


2. Multithreaded support
3. Object Pooling
4. Security etc.

a. Server
b. Webserver
c. Container
d. Application Server
16) The following
a) It is lightweight.
b) It supports pluggable look and feel.

c) It follows MVC (Model View Controller) architecture,


are the advantages of _____ .
a. Swing
b. AWT
c. Both A & B
d. None of the above
17) The ActionListener interface is not used for handling action events.
a. True
b. False
18)   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

19)Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application
a. True
b. False
20)   The APPLET tag is used to start an applet from both an HTML document and from an applet viewer.
a. True
b. False
21)   Which method is called only once during the run time of your applet?

a. stop()
b. paint()
c. init()
d. destroy()

22)Where can the event handling code be written?


a. Same class
b. Other class
c. Anonymous class
d. All mentioned above
23)The subclass of a java.awt.Component class is known as a ?
A. system
B. component
C. container
D. component manager
24)How many layout managers defined in java.awt package?
A. 2
B. 3
C. 4
D. 5
25)   Which class is used for this Processing Method processActionEvent( )?
a. Button,List,MenuItem
b. Button,Checkbox,Choice
c. Scrollbar,Component,Button
d. None of the above

26)JPanel and Applet use ___________________ as their default layout


A. border layout
B. grid layout
c.FlowLayout
D. layout manager
27)A ___________ dictates the style of arranging the components in a container.
A. border layout
B. grid layout
C. panel
D. layout manager
28)   The following
a) It is lightweight.
b) It supports pluggable look and feel.
c) It follows MVC (Model View Controller) architecture
are the advantages of _____ .
a. Swing
b. AWT
c. Both A & B
d. None of the above
29)getLabel() method used to retrieve the label of a button.
A. Yes
B. No
C. Can be yes or no
D. Can not say
30) Which of these methods can be used to determine the type of event?
a) getID()
b) getSource()
c) getEvent()
d) getEventObject()
31) What is an event in delegation event model used by Java programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and system
d) An event is a class used for defining object, to create events
32)Which of these methods are used to register a keyboard event listener?
a) KeyListener()
b) addKistener()
c) addKeyListener()
d) eventKeyboardListener()

You might also like