β˜‘ MCQ PRACTICE

Object Oriented Programming through Java Unit 4

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

πŸ“š Object Oriented Programming through Java
πŸ“– Unit 4
🎯 MCQs

Object Oriented Programming through Java - Unit-4

1
Give the abbreviation of AWT?
AApplet Windowing Toolkit
BAbstract Windowing Toolkit
CAbsolute Windowing Toolkit
DNone of the above
Correct Answer Abstract 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 Answer Frame
3
Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?
AWindow
BContainer
CPanel
DFrame
Correct Answer Container
4
Which class provides many methods for graphics programming?
Ajava.awt
Bjava.Graphics
Cjava.awt.Graphics
DNone of the above
Correct Answer java.awt.Graphics
5
_________ concept is used to create a Frame
Aencapsulation
Binheritance
Cabstraction
Dpolymorphism
Correct Answer inheritance
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 Answer Event Handling
7
In which places can put the event handling code
ASame class
BOther class
CAnnonymous class
DAll mentioned above
Correct Answer All 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 Answer java.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 Answer All mentioned above
10
The __________________ interface is not used for handling action events?
AActionListener
BKeyListener
CMouseListener
DItemListener
Correct Answer ActionListener
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 Answer Panel
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 Answer public abstract void setColor(Color c)
13
The ActionListener interface is used for handling action events,For example,it's used by a
AButton
BCheckbox
CMenuItem
DAll of these
Correct Answer All of these
14
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 Answer public void drawRect(int x, int y, int width, int height)
15
Which object can be constructed to show any number of choices in the visible window?
ALabels
BChoice
CList
DCheckbox
Correct Answer List
16
Which method can set or change the text in a Label?
AsetText()
BgetText()
CText()
DNone of the above
Correct Answer setText()
17
Which is a component in AWT that can contain another components like buttons, textfields, labels etc.?
AWindow
BContainer
CPanel
DFrame
Correct Answer Container
18
Which are passive controls that do not support any interaction with the user?
AChoice
BList
CLabels
DCheckbox
Correct Answer Labels
19
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 Answer java.awt.event
20
Where can the event handling code be written?
ASame class
BOther class
CAnonymous class
DAll mentioned above
Correct Answer All mentioned above
21
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 Answer Panel
22
The concept of the menu bar can be implemented by using three java classesβ€”
AMenuBar
BMenu
CMenuItem
DAll of these
Correct Answer All of these
23
In Java an event is an _______which specifies the change of state in the source.
AClass
BObject
CInt
DString
Correct Answer Object
24
The classes and interfaces defined in AWT are contained within the ______ package.
Ajava.awt.*
Bjava.sql.*
Cjava.io.*
Djava.int*
Correct Answer java.awt.*
25
The general form to set a specific type of layout manager is _________
Avoid setLayout(LayoutManager lm)
BVoid setLayout(LayoutManager lm)
Cvoid setLayout(layoutManager lm)
DVoid setLayout(Layoutmanager lm)
Correct Answer void setLayout(LayoutManager lm)
26
A checkbox is a control that consists of a _____________
ACombination of a small box
BA label
CCombination of a large box and a label
DBoth A & B
Correct Answer Both A & B
27
An event is generated when the internal state of the event source is________
ANot changed
BChanged
CEither changed or not
DNone of these
Correct Answer Changed
28
Positions the components into five regions:east, west, north, south, center
ABorderLayout
BCardLayout
CGridLayout
DFlowLayout
Correct Answer BorderLayout
29
Arranges the components as a deck of cards such that only one component is visible at a time
ABorderLayout
BCardLayout
CGridLayout
DFlowLayout
Correct Answer CardLayout
30
Arranges the components horizontally
ABorderLayout
BCardLayout
CGridLayout
DFlowLayout
Correct Answer FlowLayout
31
Arranges the componemnts into grid
ABorderLayout
BCardLayout
CGridLayout
DFlowLayout
Correct Answer GridLayout
32
__________ creates a dropdown list of textual entries
AChoice
BCheckbox
CTextbox
DTextComponent
Correct Answer Choice
33
How many types of events are there?
A5
B3
C2
D4
Correct Answer 2
34
To manage events, Java employs the ____?
ACustom-based Event Model
BRetired Event Model
CDelegation Event Model
DNone of the above
Correct Answer Delegation Event Model
35
____ are classes that act as a connection point between event listeners and event sources?
AEvent adapters
BEvents Handler
CEvent listener
DJevent
Correct Answer Event adapters
← Back to All MCQs