Practice objective questions
for quick revision and examination
preparation. Try answering each question
before revealing the answer.
📚 Java Programming
📖 Part 5
🎯 MCQs
Java Programming - Part-5
1
Give the abbreviation of AWT?
AApplet Windowing Toolkit
BAbstract Windowing Toolkit
CAbsolute Windowing Toolkit
DNone of the above
Correct AnswerAbstract Windowing Toolkit
2
Which is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc.?
APanel
BFrame
CWindow
DContainer
Correct AnswerFrame
3
Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?
AWindow
BContainer
CPanel
DFrame
Correct AnswerContainer
4
The following specifies the advantages of -> It is lightweight. -> It supports pluggable look and feel. -> It follows MVC (Model View Controller) architecture.
ASwing
BAWT
CBoth A & B
DNone of the above
Correct AnswerSwing
5
Which class provides many methods for graphics programming?
Ajava.awt
Bjava.Graphics
Cjava.awt.Graphics
DNone of the above
Correct Answerjava.awt.Graphics
6
The Following steps are required to perform 1) Implement the Listener interface and overrides its methods. 2) Register the component with the Listener
AException Handling
BString Handling
CEvent Handling
DNone of the above
Correct AnswerEvent Handling
7
In which places can put the event handling code
ASame class
BOther class
CAnnonymous class
DAll mentioned above
Correct AnswerAll mentioned above
8
Which package provides many event classes and Listener interfaces for event handling?
Ajava.awt
Bjava.awt.Graphics
Cjava.awt.event
DNone of the above
Correct Answerjava.awt.event
9
To use the ActionListener interface it must be implemented by a class there are several ways to do that find in the following?
ACreating a new class
Busing the class the graphical component
Can anonymous inner class
DAll mentioned above
Correct AnswerAll mentioned above
10
The ActionListener interface is used for handling action events,For example,it's used by a
AJButton
BJCheckbox
CJMenuItem
DAll of these
Correct AnswerAll of these
11
Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?
AWindow
BFrame
CPanel
DContainer
Correct AnswerPanel
12
Which method is used to set the graphics current color to the specified color in the graphics class?
Apublic abstract void setFont(Font font)
Bpublic abstract void setColor(Color c)
Cpublic abstract void drawString(String str, int x, int y)
DNone of the above
Correct Answerpublic abstract void setColor(Color c)
13
In Graphics class which method is used to draws a rectangle with the specified width and height?
Apublic void drawRect(int x, int y, int width, int height)
Bpublic abstract void fillRect(int x, int y, int width, int height)
Cpublic abstract void drawLine(int x1, int y1, int x2, int y2)
Dpublic abstract void drawOval(int x, int y, int width, int height)
Correct Answerpublic void drawRect(int x, int y, int width, int height)
14
Which object can be constructed to show any number of choices in the visible window?
ALabels
BChoice
CList
DCheckbox
Correct AnswerList
15
Which is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions?
AWindow
BPanel
CFrame
DContainer
Correct AnswerFrame
16
Which class is used for this Processing Method processActionEvent( )?
AButton,List,MenuItem
BButton,Checkbox,Choice
CScrollbar,Component,Button
DNone of the above
Correct AnswerButton,List,MenuItem
17
Which method can set or change the text in a Label?
AsetText()
BgetText()
CAll the above
DNone of the above
Correct AnswersetText()
18
Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?
AWindow
BContainer
CPanel
DFrame
Correct AnswerContainer
19
Which are passive controls that do not support any interaction with the user?
AChoice
BList
CLabels
DCheckbox
Correct AnswerLabels
20
Which package provides many event classes and Listener interfaces for event handling?