0% found this document useful (0 votes)
297 views

Awt Questions 2

The document contains a quiz with 42 multiple choice questions related to Java GUI programming and event handling concepts. Specifically, it covers topics like AWT components, layout managers, event listeners, event classes, and event handling methods. The questions test understanding of commonly used AWT classes and interfaces like Frame, Panel, Container, Button, ActionListener, and MouseListener, as well as core event handling mechanisms in Java like the delegation event model.

Uploaded by

Rupesh Bavge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
297 views

Awt Questions 2

The document contains a quiz with 42 multiple choice questions related to Java GUI programming and event handling concepts. Specifically, it covers topics like AWT components, layout managers, event listeners, event classes, and event handling methods. The questions test understanding of commonly used AWT classes and interfaces like Frame, Panel, Container, Button, ActionListener, and MouseListener, as well as core event handling mechanisms in Java like the delegation event model.

Uploaded by

Rupesh Bavge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

VISION ACADEMY

Institute of Polytechnic and Engineering

1) 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

2) Implement the Listener interface and overrides its methods is required to perform in event
handling.
a. True b. False

3) 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

4) These two ways are used to create a Frame


By creating the object of Frame class (association)
By extending Frame class (inheritance)
a. True b. False

5) Give the abbreviation of AWT?


a. Applet Windowing Toolkit
b. Abstract Windowing Toolkit
c. Absolute Windowing Toolkit
d. None of the above

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
6) Which method is used to set the graphics current color to the specified color in the
graphics class?
a. public abstract void setFont(Font font)
b. public abstract void setColor(Color c)
c. public abstract void drawString(String str, int x, int y)
d. None of the above

7) The Java Foundation Classes (JFC) is a set of GUI components which simplify the
development of desktop applications.
a. True b. False
8) Which object can be constructed to show any number of choices in the visible window?
a. Labels b. Choice c. List d. Checkbox

9) 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
10) Which method can set or change the text in a Label?
a. setText()
b. getText()
c. All the above
d. None of the above

11) Which is a component in AWT that can contain another components like buttons,
textfields, labels etc.?
a. Window
b. Container
c. Panel
d. Frame

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
12) Which are passive controls that do not support any interaction with the user?
a. Choice b. List
c. Labels d. Checkbox

13) How many types of controls does AWT support?


a. 7
b. 6
c. 5
d. 8

14) The ActionListener interface is not used for handling action events.
a. True b. False

15) Which package provides many event classes and Listener interfaces for event handling?
a. java.awt
b. java.awt.Graphics
c. java.awt.event
d. None of the above

16) The Following steps are required to perform


1) Implement the Listener interface and overrides its methods
2) Register the component with the Listener

a. Exception Handling
b. String Handling
c. Event Handling
d. None of the above

17) Where can the event handling code be written?

a. Same class
b. Other class
c. Anonymous class
d. All mentioned above
Above Yash Jewelers, In front of Pramod Super Market,
MOB- +917276535329
Ausa Road, Latur
18) Which class provides many methods for graphics programming?

a. java.awt b. java.Graphics
c. java.awt.Graphics d. None of the above

19) AWT is used for GUI programming in java

a. True
b. False

20) Name the class used to represent a GUI application window, which is optionally resizable
and can have a title bar, an icon, and menus.
a) Window
b) Panel
c) Dialog
d) Frame

21) Which class can be used to represent a checkbox with a textual label that can appear in a
menu.
a) MenuBar
b) MenuItem
c) CheckboxMenuItem
d) Menu

22) What does the following line of code do?


Textfield text = new Textfield(10);
a) Creates text object that can hold 10 rows of text.
b) Creates the object text and initializes it with the value 10.
c) Creates text object that can hold 10 columns of text.
d) The code is illegal.

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
23) Which of the following methods can be used to change the size of a java.awt.Component
object?
(A) dimension() (B) setSize() (C) area()
(D) size() (E) resize()
a) (A), (B), (C) & (E)
b) (A), (B) & (E)
c) (B) & (E)
d) (B), (D) & (E)
e) (D) & (E)

24) Which of the following methods can be used to remove a java.awt.Component object from
the display?
a) delete()
b) remove()
c) hide()
d) disappear()
e) move()

25) The setBackground() method is part of the following class in java.awt package:
a) Graphics
b) Applet
c) Container
d) Object
e) Component

26) 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 event

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
27) Which of these methods are used to register a keyboard event listener?
a) KeyListener()
b) addKistener()
c) addKeyListener()
d) eventKeyboardListener()

28) Which of these methods are used to register a mouse motion listener?
a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()

29) What is a listener in context to event handling?


a) A listener is a variable that is notified when an event occurs
b) A listener is a object that is notified when an event occurs
c) A listener is a method that is notified when an event occurs
d) None of the mentioned

30) Event class is defined in which of these libraries?


a) java.io b) java.lang
c) java.net d) java.util

31) Which of these methods can be used to determine the type of event?
a) getID() b) getSource()
c) getEvent() d) getEventObject()

32) Which of these class is super class of all the events?


a) EventObject b) EventClass
c) ActionEvent d) ItemEvent

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
33) Which of these events will be notified if scroll bar is manipulated?
a) ActionEvent
b) ComponentEvent
c) AdjustmentEvent
d) WindowEvent

34) Which of these events will be generated if we close an applet’s window?


a) ActionEvent b) ComponentEvent
c) AdjustmentEvent d) WindowEvent

35) Which of these interfaces handles the event when a component is added to a container?
a) ComponentListener
b) ContainerListener
c) FocusListener
d) InputListener

36) Which of these interfaces define a method actionPerformed()?


a) ComponentListener
b) ContainerListener
c) ActionListener
d) InputListener

37) Which of these interfaces define four methods?


a) ComponentListener
b) ContainerListener
c) ActionListener
d) InputListener

[componentResized(), componentMoved(), componentShown() and componentHidden().]

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur
38) Which of these methods will respond when you click any button by mouse?
a) mouseClicked()
b) mouseEntered()
c) mousePressed()
d) All of the mentioned

39) Which of these methods will be invoked if a character is entered?


a) keyPressed()
b) keyReleased()
c) keyTyped()
d) keyEntered()

40) Which of these methods is defined in MouseMotionAdapter class?


a) mouseDragged()
b) mousePressed()
c) mouseReleased()
d) mouseClicked()

41) Which of these are constants defined in WindowEvent class?


a) WINDOW_ACTIVATED
b) WINDOW_CLOSED
c) WINDOW_DEICONIFIED
d) All of the mentioned

42) Which of these is superclass of all Adapter classes?


a) Applet
b) ComponentEvent
c) Event
d) InputEvent

Above Yash Jewelers, In front of Pramod Super Market,


MOB- +917276535329
Ausa Road, Latur

You might also like