0% found this document useful (0 votes)
20 views23 pages

Ajp QB Main

Uploaded by

tejasborseee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views23 pages

Ajp QB Main

Uploaded by

tejasborseee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

JPanel and Applet use

as their
default layout
Ans: FlowLayout
2. Which are various AWT controls
from following?
Ans: Labels, Push buttons, Check
boxes, Choice lists.
3. Which of the following component
class cannot be add on applet
Ans: Menu
4. A checkbox is a control that
consists of a
Ans:Combination of a small box
and a Label
5. "A Frame's
designates the area of theframe
excluding the title,
menu bar and the border."
Ans: ContentPane
6. A GUI stands for .
Ans: Graphical User Interface
7. A JCheckBoxMenuItem is a subclass
of .
Ans: ?????
8. A label is a simple control which is
used to display
on the window
Ans: Text(non-editable)
9. A ScrollPane is
Ans: Container
10. "A superclass of Textfield and
TextArea classes that is used to
create single-line ,
multiline textfields rexpectively
is ."
Ans: Textcomponent
11. A is a component that
appears as a group of folders in a
file cabinet.
Ans: JTabbedPane
12. A automatically
arranges the components added to
a container.
Ans: Layout Manager
13. A is a passive AWT
control which do not generate any
event.
Ans: Label
14. A
component
is a display area for a short string of
text, image or both.
Ans: Jlabel
15. All Component on Container can
be removed by calling following
method
Ans: removeAll()
16. Allswing component classes are
placed in
Ans: javax.swing
17. An Applet is of
Panel
Ans: subclass
18. Applet Container is used toprepare
output window.
Ans: ?????
19. AppletViewer tool is available in
which of the folder of JDK
Ans: bin
20. Arranges the components as a deck
of cards such that only one
component is visible at atime
Ans: CardLayout
21. At the top of the AWT hierarchy is
the class.
Ans: Component
22. AWT classes are contained in the
package
Ans: java.awt
23. AWT is used for creating a GUI in
Java. AWT standsfor
Ans: Abstract Window Toolkit
24. AWTEvent Class is define in
following package
Ans: java.awt
25. A is Componenet that
represents a hierarchical view of
data
Ans: Jtree
26. A is component that
presents a rectangular area in
which a component may be viewed
Ans: Scroll Pane
27. BorderLayoutisdivided
into regions
Ans: five
28. BorderLayout class has
regionstoadd
components to it
Ans: Five
29. By default flowlayout uses
justification.
Ans: Center
30. By default page-up and page-down
increment of scrollbar
is .
Ans: 10
31. By default the Frame hasa
_
Ans: Titlebar,borders,resizing
corners
32. By default which layout manageris
set on applet
Ans: FlowLayout
33. By which method You can set or
change the text in aLabel?
Ans: setText()
34. Canvas is a
Ans: Window
35. Checkable menu items are created
using object of …………………….class.
Ans: CheckboxMenuItem
36. Combobox is a combination of
Ans: TextField and Dropdown List
37. Components are added to which
pane of swing JApplet.
Ans: ContentPane
38. constructors of Jseparator are
Ans: both i and ii
39. Container is the sub classof?
Ans: Component
40. Control not support by awt are
Ans: TabbedPane,Table
41. Current text of label can be
obtained using
.
Ans: getText ()
42. Deafult layout manager for Frameis
.
Ans: BorderLayout
43. Default layout manager for panelis
Ans: FlowLayout
44. Default layout manager for
Window is
Ans: Borderlayout
45. Default Layout of Frame
Ans: BorderLayout
46. Default orientation of progress bar
is:
Ans: Horizontal
8. are new features of ?"
Ans: Swing
49. Each menu is associated with a
list of menu items
Ans: Drop-down
50. Every layout manager is an instance
of .
Ans: the LayoutManager interface
51. Executable applet is nothing but
file of applet
Ans:.class
52. FileDialog is which kind of dialog
box?
Ans: Modaltype
53. FlowLayout arrangescomponents
from
Ans: Left to Right
54. FlowLayout does not support this
value of alignment…
Ans: FlowLayout.BASELINE
55. Font class is available in
Ans: java.awt package
56. For adding controls to a window,
we use following method
Ans: add()
57. for using Swing control one must
import
pacakge
Ans: import javax.swing.*
58. Frame is a standard window,which
is of
Window class from AWT hierarchy
Ans: sub class
59. getContentPane() method of which
class
Ans: JApplet
60. getSelectedCheckbox() mehod of
which class
Ans: CheckboxGroup
61. How can the Checkbox class be
used to create a radio button in
AWT?
Ans: By associating Checkbox
objects with a CheckboxGroup
62. How do you change the current
layout managers for a container?
Ans: Use the setLayout() method
63. Howmany checkboxes we can
check at a time:
Ans: multiple
64. How To Apply Image To Button ?
Ans: Using ImageIcon
65. How would you set the color of a
graphics context called g to cyan?
Ans: g.setColor(Color.cyan);
66. Identify the correct constructor of
Font class?
Ans: Font( String name, int
fontstyle,int pointsize)
67. Identify wrong constructor of
Checkbox
Ans: ?????
68. In applet, which of the following
tag is used for accepting user
defined parameter?
Ans: Param
69. In AWT Checkbox class is used to
create
Ans: Checkbox and Radio buttons
70. In AWT Radio buttons are created
using
Ans: CheckBoxGroup
71. In FlowLayout manager the default
space between each component is
Ans: 5 Pixel
72. In Graphics class Which method is
used to set the graphics current
color to the specifiedcolor?
Ans: public abstract void
setColor(Color c)
In how many ways we can define
the scrollbar?
Ans: ?????
74. In Swing Buttons are the subclasses
of which class?
Ans: AbstractButton
75. In Swing the content pane canbe
obtained via method
Ans: getContentPane()
86. List can be created for multiple
selection by using following
constructor.
Ans: List(int num,boolean
multiselect)
87. Model is the oftheMVC
architecture.
Ans: bottom most level
88. mouse click will alwaysgenerate
76. In Swing is a event?
component that displays rows and
columns of data.
Ans: table
77. In Swing, tables are implemented
by the class
Ans: JTable
78. Indentify which is a valid
constructor of MenuItem class?
Ans:MenuItem(String Itemname)
79. Items are added in JComboBox
using method……?
Ans: addItem()
80. JApplet class is Derived form
Ans: Applet
81. Java supports input/output of data
through the classes included in the
package:
Ans: Java.io
82. JCheckBox is
Compon
ent
Ans: lightweight
83. JRadioButton is a subclass of
.
Ans: AbstractButton
84. JTabbedPane classis present in
which package?
Ans: javax.swing
85. Jtree class comes under which
package
Ans: javax.swing
Ans: MouseEvent
89. MutableTreeNode is
extends interfa
ce
Ans: TreeNode
90. MVC Architecture is
Ans: Model-View-Controller
91. "Name the class used to represent a
GUI application window, which is
optionally resizable and can have a
title bar, an icon, andmenus"
Ans: Frame
92. On which side applet always
executed?
Ans: Client side
93. Package of drawString() method is
Ans: java.awt
94. Panel is defined as
Ans: All of above
95. Panel isused for
components
Ans: Grouping
96. Plugable Look & Feel is the feature
of
Ans: Swing
97. Positions the componenets into five
regions: east, west, north, south,
center
Ans: BorderLayout
99. public class MenuBar extends
Ans: MenuComponent
100. Scrollbar( ) creates a
scroll barby
default.
Ans: Vertical
101.Select the proper constructor of
FileDialog
Ans: FileDialog(Frame parent,
Ans: java.applet
111. The AWT container is an instance
of the class which
holds various components and
other containers
Ans: Container
112. TheCardLayout class definesthe
following constructors:
Ans: CardLayout() // First
Cardlayout(inthor,intver)//second
102.
103.
String boxName)
Select the proper syntax to
addcomponent in an applet
Ans: Component add(Component
comoObj)
setBorder() method is used to set a
113.
114.
The CardLayout class manages the
components in such a manner that
component isvisible
at a time
Ans: Only one
The concept of the menu bar canbe
104.
border for ?
Ans: Jcomponent
setMenuBar() method of which
implemented by using three java
classes—
Ans: ?????
105.
class
Ans: Frame
State true of false i) AWT is an
115. The coordinate of theupper-left
corner of a frame is .
Ans: (0, 0)
extended version of swing ii) Paint(
) of Applet class cannot be
overridden
116.
117.
The correct hierchy for panel is
Ans: Component-Container-Panel
The default layout manager for the
106.
Ans: i-false, ii-false
Swing components are
content pane of a swing based
applet is
Ans: lightweight and platform
independent 118.
Ans: Border-Layout
"The following specifies the
107. swing is the set of
that provides more powerful &
flexible components as compare to
AWT. 119.
advantages of
Ans: It is lightweight. It supports
pluggable look and feel.
It follows MVC (Model View
108.
Ans: Classes
Text field usually called as
Controller) architecture."
Ans: Swing
109.
Ans: edit control
TextField class is used
for
120. The method drawRect() is used to
display an
110.
Ans: Single-Line text-entry area
The Applet class is in ………..package
Ans: outlined rectangle
121. The method setLabel can be used 131. The TextArea controls create a
with what type of Object ? respectively.
Ans: TextField. Ans: Multi-line text
122. The method gets the text of 132. the various Control Supported by
the button jtb is AWT are
Ans: jtb.getText( ) Ans: ?????
123. the method places a 133. The various controls supported by
menu mu into a menu bar mb. swing are:
Ans: mb.add(mu) Ans: ?????
124. The method sets 134. The arranges
the foreground color to yellow in components in rows and columns
Jframe and makes all components the
Ans: f.setForeground same size.
(Color.YELLOW) Ans: GridLayout manager
125. The method 135. The interface is used
creates a to handle button events:
IconImage for file c:\image\us.gif Ans: ActionListener
Ans: new 136. The class is usedto
ImageIcon("c:\image\us.gif&q create radio button in AWT
uot;); Ans: CheckboxGroup
126. The method 137. The Can be
gets the text used to enter or display a string
(or caption) of the label jlbl Ans: textfield
Ans: jlbl.getText() 138. "These four methods commonly
127. The setBackground() method is used in? 1)public void
part of the following class in add(Component c) 2)public void
java.awt package: setSize(int width,int height)
Ans: Component 3)public void
128. The string parameter to the JButton setLayout(LayoutManager m)
constructor tells 4)public void setVisible(boolean)"
Ans: what text will appear on the Ans: Component class
button 139. To create window with title bar
129. The Swing component classes that which of the following class is
are used in encapsulate a mutually used?
exclusive set of buttons are? Ans: Frame
Ans: ButtonGroup 140. To create file dialog box
130. The syntax for drawRect() method class is used
is Ans: FileDialog
Ans: drawRect(int top, int left, int 141. To display text on the applet
width, int height) method is used.
Ans: drawString()
142. To draw a line in applet, we use
following method
154. What is default alignment of
components using FlowLayout
Ans: drawLine() Ans: FlowLayout.CENTER
143. To fetch caption of 155. what is default layout manager for
button methodisused. panels and applets
Ans: getLabel( ) Ans: FlowLayout
144. To retrieve the current state of a 156. What is the default layout for a
check box,call dialog?
Ans: BorderLayout
Ans: getState() 157. What is the difference between a
145. To set title to the frame TextArea and a TextField?
window method is Ans: A TextArea can handle
used. multiple lines of text
Ans: void setTitle(String str) 158. What is the minimum and
146. We can add menus to maximum of JProgressBar
Ans: minimum -0 Maximum -100
Ans: Frames 159. What is the use of following
147. What are controls or components? method in JDialog? Container
Ans: Controls or components allow getContentPane()
users to interact with application Ans: This method returns,a
148. What are the TextCompoent ? Content Pane for the JDialog.
Ans: TextField , TextArea 160. What is use of 3rd parameter in
149. What Are The Types of Dialogbox ? given constructor
Scrollbar(int,int,int,int,int)
Ans: modal and Modeless Ans: Thumbsize
Dialogbox 161. What is use of second parameter in
150. What are the variables defined in given constructor Label(String,int)
Dimension Ans:sepcifiesthe alignment of text
Ans: height and width in label in terms of pixel
151. What Checkbox method allows you 162. what layout manager should you
to tell if a Checkbox is checked? use so that every component
Ans: getState() occupies the same size in the
152. What does the following line of container?
code do? TextField text = new Ans: GridLayout
TextField(10); 163. What letter precedes Swing
Ans: Creates text object that can component names that have a
hold 10 columns of text. corresponding AWT component?
153. What is API Ans: J
Ans: Application Programming 164. What method is used to prevent a
Interface user from changing the size of a
Frame() object?
Ans: setResizable( false ) Ans: TextArea
165. What methods are used to get and 177. Which class can be used to
set the text label displayed by a represent a checkbox with a textual
Button object? label that can appear in a menu.
Ans: getLabel( ) and setLabel( ) Ans: CheckboxMenuItem
166. When DialogBox is closed which 178. Which class creates a node in Jtree?
method gets called Ans: DefaultMutableTreeNode
Ans: dispose() 179. Which class defines the setSize( )
167. When layout manager is disabled , method ?
which method is used to determine Ans: Frame
the shape and position of 180. Which class encapsulates a blank
Component? window upon which we can draw?
Ans: setBounds Ans: Canvas
168. When we invoke repaint() for a 181. Which class is on the top of the
java.awt.Component object, the AWT event hierarchy?
AWT invokes the method: Ans: java.awt.AWTEvent
Ans: update() 182. Which class is used to create a pop169. which method is used to set the
up list of items from which the user
visibility of the frame? may choose?
Ans: setVisible(true) Ans: Choice
170. which package we need to import 183. Which Class is used to get
while writng swing JRadioButton dimension of an Applet?
class Ans: Dimension
Ans: import javax.swing.*; 184. Which class is used to represent a
171. Which abstract class is the super single line textbox with password
class of all menu related classes. character facility?
Ans: MenuComponent Ans: TextField
172. Which Among the below is not an 185. Which class provides many
AWT class methods for graphics
Ans: RadioButton programming?
173. Which are the Alignment Constant Ans: java.awt.Graphics
of Label ? 186. Which componant canot be added
Ans: All The Above to a container?
174. Which are the subclasses of the Ans: JFrame
container class? 187. Which component displays
Ans: Windows,Panel,ScrollPane. information in hierarchical manner
175. Which AWT component is not with parent-child relationship?
editable? Ans: JTree
Ans: Label
176. Which AWT control is used for
multi-line text entry?
188. Which component in swing
represents data in rows and
columns?
Ans: JTable
189. Which Component of AWT
provides a compact, multichoice ,
scrolling selection?
Ans: List
190. "Which components are needed to
getfollowing shown output Figure:-
"
Enter Name Her
Ans: Label,TextField
191. which Container use a Border
Layout astheir default layout?
Ans: ?????
192. Which containers may have a
MenuBar?
Ans: Frame
193. Which control is not contain in
AWT Package ?
Ans: Scrollpane
194. Which h costructor creates a
TextArea with 10 rows and 20
columns ?
Ans: new TextArea(10 , 20 )
195. Which is Controll in swing a
combination of a text field and a
dropdown list
Ans: JComboBox
196. Which is correct method foradding
button component into North
region of borderlayout? Assume b1
as button object .
Ans: add(b1, BorderLayout.NORTH)
197. which is default layout Manager for
Japplet?
Ans: BorderLayout
198. Which is immediate super class for
TextField?
Ans: TextComponent
199. Which is the a constructor of
JTabbed Pane
Ans: ?????
200. Which is the correct constructor for
JProgressBar
Ans: ?????
201. Which is the correct constructor of
GridLayout
Ans: GridLayout(int numrows, int
numcols)
202. Which is the immediate super class
of Applet?
Ans: Panel
203. Which is the method is used to
count the number ofitemsin the
list
Ans: getItemCount()
204. Which is true aboutswing?
Ans: ?????
205. Which is various methods of
TextFieldcontrolfromfollowing?
Ans:
getText(),setText(),setEchoChar()
206. Which layout arranges the
components as a deck of cards such
that only one component is visible
at a time
Ans: CardLayout
207. Which layout should you use to
organize the components of a
container in a tabular form?
Ans: GridLayout
208. Which method exectues only once
Ans: init() method
209. Which method gets the text
associated withLabel objectjlbl?
Ans: jlbl.getText()
210. Which method Is used to add items
to JComboBox
Ans: addItem()
211. Which method is used to add tabs
to a JTabbedPane?
Ans: addTab()
212. Which method is used to change Ans: ?????
size and position of Components? 224. Which of the following are passed
Ans: void setBounds(int x,int y,int as an argument to the paint( )
width,int height) method?
213. Which method is used to change Ans: A Graphics object
the name of a menu item 225. Which of the following are
Ans: void setLabel(String subclasses of Container Class?
newName) Ans: ScrollPane,Vector,String
214. Which method is used to close a 226. Which of the following are
swing frame? subclasses of java.awt.Component?
Ans: setDefaultCloseOperation() Ans: Container
215. Which method is used to display 227. Which of the following are true?
Label on checkbox? Ans: Panel extends Container.
Ans: String getLabel() 228. which of the following class is
216. Which method is used to set label Derived from Container Class?
for Button B ? Ans: Panel
Ans: B.setLabel(String s) 229. Which of the following class act as
217. Which method is used to set the a super class in class hierachy?
dimensions of the window. Ans: Component
Ans: void setSize(int newWidth, int 230. Which of the following components
newHeight) allow multiple selections?
218. Which method is used to set the Ans: List
layout of the Applet? 231. Which of the following components
Ans: setLayout(); does not have visible borders?
219. Which method sets the size and Ans: Panel
position of a component 232. Which of the following contain a
Ans: setBounds() Menubar?
220. Which method will cause a Frame Ans: A Frame
to be displayed? 233. Which of the following controls
Ans: setVisible( true) does not support interaction with
221. Which object can be constructed to user?
show and select any number of Ans: Label
choices in the visible window? 234. Which of the following creates a
Ans: List List with 5 visible items and
222. Which of the following applet tags multiple selection enabled?
is legal to embed an applet class Ans: new List(5, true)
named Test into a Web page? 235. which of the following is not a
Ans: < applet code = Test.class AWT control.
width = 200 height = 100> </applet> Ans: ButtonGroup
223. Which of the following are not 236. Which of the following is not a
swing componant? constructor of JTree
Ans: JTree(int x)
237. Which of the following is not a
swing class?
Ans: Canvas
238. Which of the following is not active
control
Ans: labels
239. Which of the following is not an
AWT component
Ans: Applet
240. Which of the following is not true
about Dialog Boxes?
Ans: Dialog boxes contains menu
bars.
241. Which of the following is not true
about Swing Components?
Ans: Heavy weight components
242. Which of the following is not valid
alignment constant for Label?
Ans: MIDDLE
243. Which of the following is not valid
constructor forJCheckBox?
Ans: JCheckBox(String text,
boolean selected, CheckboxGroup
group)
244. Which of the following is not valid
style constant for Font?
Ans: NORMAL
245. Which of the following is passive
AWT control?
Ans: Label
246. Which of the following isthe
immidiate superclass of the
MenuComponent class?
Ans: Object
247. Which of the following istrue
about AWT and Swing
Component?
Ans: AWT Components create a
process where as SwingComponent
create a thread
248. Which of the following is used to
interpret and execute Java Applet
Classes hosted by HTML ?
Ans: Appletviewer
249. Which of the following layout
managers need to create a Panel?
Ans: CardLayout
250. Which of the following may a menu
contain?
Ans: menu
251. Which of the following may contain
a menu bar?
Ans: frame
252. Which of the following method is
use to add a button “b” to the south
of the applet using BorderLayout?
Ans: add(b,BorderLayout.SOUTH);
253. Which of the following method is
used to change the Label caption?
Ans: setText(String s)
254. Which of the following method is
used to retrive icon of JButton
Ans: Icon getIcon()
255. Which of the following methods are
invoked by the AWT to support
paint and repaint operations?
Ans: repaint( )
256. Which of the following methods
can be used to change the size of a
java.awt.Component object?
Ans: setSize()
257. Which of the following methods
can be used to remove java.awt
component object from display?
Ans: remove()
258. Which of the following statements
about GUI components is wrong ?
Ans: The AWT classes are
deprecated

You might also like