You are on page 1of 14

1. JPanel and Applet use 11.

A is a component that
as their appears as a group of folders in a
default layout file cabinet.
Ans: FlowLayout Ans: JTabbedPane
2. Which are various AWT controls 12. A automatically
from following? arranges the components added to
Ans: Labels, Push buttons, Check a container.
boxes, Choice lists. Ans: Layout Manager
3. Which of the following component 13. A is a passive AWT
class cannot be add on applet control which do not generate any
Ans: Menu event.
4. A checkbox is a control that Ans: Label
consists of a 14. A
Ans: Combination of a small box component
and a Label is a display area for a short string of
5. "A Frame's text, image or both.
designates the area of theframe Ans: Jlabel
excluding the title, 15. All Component on Container can
menu bar and the border." be removed by calling following
Ans: ContentPane method
6. A GUI stands for . Ans: removeAll()
16. All swing component classes are
Ans: Graphical User Interface placed in
7. A JCheckBoxMenuItem is a subclass Ans: javax.swing
of . 17. An Applet is of
Ans: ????? Panel
8. A label is a simple control which is Ans: subclass
used to display 18. Applet Container is used toprepare
on the window output window.
Ans: Text(non-editable)
9. A ScrollPane is Ans: ?????
19. AppletViewer tool is available in
Ans: Container which of the folder of JDK
10. "A superclass of Textfield and Ans: bin
TextArea classes that is used to 20. Arranges the components as a deck
create single-line , of cards such that only one
multiline textfields rexpectively component is visible at atime
is ." Ans: CardLayout
Ans: Textcomponent 21. At the top of the AWT hierarchy is
the class.
Ans: Component
22. AWT classes are contained in the Ans: setText()
package 34. Canvas is a
Ans: java.awt Ans: Window
23. AWT is used for creating a GUI in 35. Checkable menu items are created
Java. AWT stands for using object of ............................ class.
Ans: Abstract Window Toolkit
24. AWTEvent Class is define in Ans: CheckboxMenuItem
following package 36. Combobox is a combination of
Ans: java.awt
25. A is Componenet that Ans: TextField and Dropdown List
represents a hierarchical view of 37. Components are added to which
data pane of swing JApplet.
Ans: Jtree Ans: ContentPane
26. A is component that 38. constructors of Jseparator are
presents a rectangular area in Ans: both i and ii
which a component may be viewed 39. Container is the sub classof?
Ans: Scroll Pane Ans: Component
27. Border Layoutisdivided 40. Control not support by awt are
into regions
Ans: five Ans: TabbedPane,Table
28. BorderLayout class has 41. Current text of label can be
regionstoadd obtained using
components to it .
Ans: Five Ans: getText ()
29. By default flowlayout uses 42. Deafult layout manager for Frameis
justification. .
Ans: Center Ans: BorderLayout
30. By default page-up and page-down 43. Default layout manager for panelis
increment of scrollbar
is . Ans: FlowLayout
Ans: 10 44. Default layout manager for
31. By default the Frame hasa Window is
Ans: Borderlayout
_ 45. Default Layout of Frame
Ans: Titlebar,borders,resizing Ans: BorderLayout
corners 46. Default orientation of progress bar
32. By default which layout manager is is:
set on applet Ans: Horizontal
Ans: FlowLayout 47. "Double-buffering built in, tool tips,
33. By which method You can set or dockable tool bars, keyboard
change the text in a Label? accelerators, custom cursors, etc.
48. are new features of ?" 61. How can the Checkbox class be
Ans: Swing used to create a radio button in
49. Each menu is associated with a AWT?
list of menu items Ans: By associating Checkbox
Ans: Drop-down objects with a CheckboxGroup
50. Every layout manager is an instance 62. How do you change the current
of . layout managers for a container?
Ans: the LayoutManager interface Ans: Use the setLayout() method
51. Executable applet is nothing but 63. How many checkboxes we can
file of applet check at a time:
Ans:.class Ans: multiple
52. FileDialog is which kind of dialog 64. How To Apply Image To Button ?
box? Ans: Using ImageIcon
Ans: Modaltype 65. How would you set the color of a
53. FlowLayoutarrangescomponents graphics context called g to cyan?
from Ans: g.setColor(Color.cyan);
Ans: Left to Right 66. Identify the correct constructor of
54. FlowLayout does not support this Font class?
value of alignment… Ans: Font( String name, int
Ans: FlowLayout.BASELINE fontstyle,int pointsize)
55. Font class is available in 67. Identify wrong constructor of
Checkbox
Ans: java.awt package Ans: ?????
56. For adding controls to a window, 68. In applet, which of the following
we use following method tag is used for accepting user
Ans: add() defined parameter?
57. for using Swing control one must Ans: Param
import 69. In AWT Checkbox class is used to
pacakge create
Ans: import javax.swing.* Ans: Checkbox and Radio buttons
58. Frame is a standard window,which 70. In AWT Radio buttons are created
is of using
Window class from AWT hierarchy Ans: CheckBoxGroup
Ans: sub class 71. In FlowLayout manager the default
59. getContentPane() method of which space between each component is
class Ans: 5 Pixel
Ans: JApplet 72. In Graphics class Which method is
60. getSelectedCheckbox() mehod of used to set the graphics current
which class color to the specified color?
Ans: CheckboxGroup Ans: public abstract void
setColor(Color c)
73. In how many ways we can define 86. List can be created for multiple
the scrollbar? selection by using following
Ans: ????? constructor.
74. In Swing Buttons are the subclasses Ans: List(int num,boolean
of which class? multiselect)
Ans: AbstractButton 87. Model is the ofthe MVC
75. In Swing the content pane canbe architecture.
obtained via method Ans: bottom most level
Ans: getContentPane() 88. mouse click will alwaysgenerate
76. In Swing is a event?
component that displays rows and Ans: MouseEvent
columns of data. 89. MutableTreeNode is
Ans: table extends interfa
77. In Swing, tables are implemented ce
by the class Ans: TreeNode
Ans: JTable 90. MVC Architecture is
78. Indentify which is a valid Ans: Model-View-Controller
constructor of MenuItem class? 91. "Name the class used to represent a
Ans: MenuItem(String Itemname) GUI application window, which is
79. Items are added in JComboBox optionally resizable and can have a
using method……? title bar, an icon, and menus"
Ans: addItem() Ans: Frame
80. JApplet class is Derived form 92. On which side applet always
Ans: Applet executed?
81. Java supports input/output of data Ans: Client side
through the classes included in the 93. Package of drawString() method is
package: Ans: java.awt
Ans: Java.io 94. Panel is defined as
82. JCheckBox is Ans: All of above
Compon 95. Panel isused for
ent components
Ans: lightweight Ans: Grouping
83. JRadioButton is a subclass of 96. Plugable Look & Feel is the feature
. of
Ans: AbstractButton Ans: Swing
84. JTabbedPane class is present in 97. Positions the componenets into five
which package? regions: east, west, north, south,
Ans: javax.swing center
85. Jtree class comes under which Ans: BorderLayout
package 98. Program which executes applet is
Ans: javax.swing known as
Ans: Appletviewer Ans: java.applet
99. public class MenuBar extends 111. The AWT container is an instance
of the class which
Ans: MenuComponent holds various components and
100. Scrollbar( ) creates a other containers
scroll barby Ans: Container
default. 112. The CardLayout class defines the
Ans: Vertical following constructors:
101. Select the proper constructor of
FileDialog Ans: CardLayout() // First
Ans: FileDialog(Frame parent, Cardlayout(inthor, intver)//second
String boxName) 113. The CardLayout class manages the
102. Select the proper syntax to components in such a manner that
addcomponent in an applet component isvisible
Ans: Component add(Component at a time
comoObj) Ans: Only one
103. setBorder() method is used to set a 114. The concept of the menu bar canbe
border for ? implemented by using three java
Ans: Jcomponent classes—
104. setMenuBar() method of which Ans: ?????
class 115. The coordinate of theupper-left
Ans: Frame corner of aframe is .
105. State true of false i) AWT is an Ans: (0, 0)
extended version of swing ii) Paint( 116. The correct hierchy for panel is
) of Applet class cannot be Ans: Component-Container-Panel
overridden 117. The default layout manager for the
Ans: i-false, ii-false content pane of a swing based
106. Swing components are applet is
Ans: lightweight and platform Ans: Border-Layout
independent 118. "The following specifies the
107. swing is the set of advantages of
that provides more powerful & Ans: It is lightweight. It supports
flexible components as compare to pluggable look and feel.
AWT. 119. It follows MVC (Model View
Ans: Classes Controller) architecture."
108. Text field usually called as Ans: Swing
Ans: edit control 120. The method drawRect() is used to
109. TextField class is used display an
for
Ans: Single-Line text-entry area Ans: outlined rectangle
110. The Applet class is in .............. package
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 154. What is default alignment of
following method components using FlowLayout
Ans: drawLine() Ans: FlowLayout.CENTER
143. To fetch caption of 155. what is default layout manager for
button method is used. 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: sepcifies the 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 pop-
169. 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 188. Which component in swing
176. Which AWT control is used for represents data in rows and
multi-line text entry? columns?
Ans: JTable 200. Which is the correct constructor for
189. Which Component of AWT JProgressBar
provides a compact, multichoice , Ans: ?????
scrolling selection? 201. Which is the correct constructor of
Ans: List GridLayout
190. "Which components are needed to Ans: GridLayout(int numrows, int
get following shown output Figure:- numcols)
" 202. Which is the immediate super class
Enter Name Her of Applet?
Ans: Label,TextField Ans: Panel
191. which Container use a Border 203. Which is the method is used to
Layout as their default layout? count the number of items in the
Ans: ????? list
192. Which containers may have a Ans: getItemCount()
MenuBar? 204. Which is true about swing?
Ans: Frame Ans: ?????
193. Which control is not contain in 205. Which is various methods of
AWT Package ? TextFieldcontrolfromfollowing?
Ans: Scrollpane Ans:
194. Which h costructor creates a getText(),setText(),setEchoChar()
TextArea with 10 rows and 20 206. Which layout arranges the
columns ? components as a deck of cards such
Ans: new TextArea(10 , 20 ) that only one component is visible
195. Which is Controll in swing a at a time
combination of a text field and a Ans: CardLayout
dropdown list 207. Which layout should you use to
Ans: JComboBox organize the components of a
196. Which is correct method foradding container in a tabular form?
button component into North Ans: GridLayout
region of border layout? Assume b1 208. Which method exectues only once
as button object . Ans: init() method
Ans: add(b1, BorderLayout.NORTH) 209. Which method gets the text
197. which is default layout Manager for associated with Label object jlbl?
Japplet? Ans: jlbl.getText()
Ans: BorderLayout 210. Which method Is used to add items
198. Which is immediate super class for to JComboBox
TextField? Ans: addItem()
Ans: TextComponent 211. Which method is used to add tabs
199. Which is the a constructor of to a JTabbedPane?
JTabbed Pane Ans: addTab()
Ans: ?????
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) 248. Which of the following is used to
237. Which of the following is not a interpret and execute Java Applet
swing class? Classes hosted by HTML ?
Ans: Canvas Ans: Appletviewer
238. Which of the following is not active 249. Which of the following layout
control managers need to create a Panel?
Ans: labels
239. Which of the following is not an Ans: CardLayout
AWT component 250. Which of the following may a menu
Ans: Applet contain?
240. Which of the following is not true Ans: menu
about Dialog Boxes? 251. Which of the following may contain
Ans: Dialog boxes contains menu a menu bar?
bars. Ans: frame
241. Which of the following is not true 252. Which of the following method is
about Swing Components? use to add a button “b” to the south
Ans: Heavy weight components of the applet using BorderLayout?
242. Which of the following is not valid Ans: add(b,BorderLayout.SOUTH);
alignment constant for Label? 253. Which of the following method is
Ans: MIDDLE used to change the Label caption?
243. Which of the following is not valid Ans: setText(String s)
constructor for JCheckBox? 254. Which of the following method is
Ans: JCheckBox(String text, used to retrive icon of JButton
boolean selected, CheckboxGroup Ans: Icon getIcon()
group) 255. Which of the following methods are
244. Which of the following is not valid invoked by the AWT to support
style constant for Font? paint and repaint operations?
Ans: NORMAL Ans: repaint( )
245. Which of the following is passive 256. Which of the following methods
AWT control? can be used to change the size of a
Ans: Label java.awt.Component object?
246. Which of the following is the Ans: setSize()
immidiate superclass of the 257. Which of the following methods
MenuComponent class? can be used to remove java.awt
Ans: Object component object from display?
247. Which of the following is true Ans: remove()
about AWT and Swing 258. Which of the following statements
Component? about GUI components is wrong ?
Ans: AWT Components create a Ans: The AWT classes are
process where as Swing Component deprecated
create a thread
259. Which of the following statements 270. Which of these methods cannot be
is for placing the frames upper left called on JLabel object?
corner to (200,100)? Ans: setBorderLayout()
Ans: frame.setLocation(200,100) 271. Which of these methods cannot be
260. Which of the following swing called on TextArea?
components donot have an Icon Ans: String getItem(int index)
parameter in its constructor? 272. Which of these methods is usedto
Ans: JTextField setting the winwods dimension
261. Which of the follwing is Ans: void setSize(Dimension
constructor of Jtable? new_size)
Ans: JTable(Objectdata[][], Object 273. which of these methods usein
colHeads[]) cardlayout
262. Which of the method can be used Ans: add(String s, Component c)
to output a string in an applet? 274. Which of these package is used for
Ans: drawString() graphical user interface ?
263. Which of the method Choice class Ans: java.awt
returns a string containing the 275. Which of these packages contains
name of the item. all the classes and methods
Ans: String getSelectedItem() required for event handling in Java?
264. Which of the subclasses of Ans: java.awt.event
java.awt.component? 276. Which one is the valid constructor
Ans: Container classes of JCheckBox.
265. Which Of these Compenent can be Ans: JCheckBox(Sting s, Icon I,
added to frame? Boolean State)
Ans: ????? 277. Which one method is used to set
266. Which of these following is not a the visibility of the frame?
component of swing Ans: setVisible(true)
Ans: List 278. Which package use for import the
267. Which of these method cannot be swing components?
called on JLabel object? Ans: javax.swing.*;
Ans: setBorderLayout() 279. Which TextComponent method is
268. Which of these methods can be used to set a TextComponent to the
used to obtain the reference to the read-only state?
container that generated a Ans: setEditable
ContainerEvent? 280. which type of button is belongs to a
Ans: getContainer() group such that only one button in
269. Which of these methods can be the group may be selected at one
used to output a string in an time?
applet? Ans: CheckboxGroup
Ans: drawString() 281. Which of these events is generated
when a button is pressed?
Ans: ActionEvent Ans: JTextField
282. Why are swing componenttermed 294. is a Swing layout
as lightweight ? manager that arranges components
Ans: they do not depend on native in a row or a column.
platform Ans: GridLayout
283. Why we use Applet? 295. method is used to add
Ans: Option A) and B) FROM this items in Combobox.
284. Window is super class of Ans: addItem()
296. method is used to add
Ans: Frame the menubar on frame window.
285. Window, frame and dialoguse Ans: setMenuBar()
as their default layout. 297. method returns
Ans: BorderLayout currently selected item in choice.
286. You can construct a JTabbedPane
using . Ans: getSelectedItem( )
Ans: new JTabbedPane() 298. can be used to enter
287. You Can set the alignment of the and display a string
string within the label by calling Ans: A TextField
299. class is used to create
Ans: setAlignment() set of mutually exclusive
288. "You want to construct a text area checkboxes.
that is 80 character-widths wide Ans: CheckboxGroup
and 10 character-heights tall. What 300. Layout lays
code do you use ?" components in a Two Dimensional
Ans: new TextArea( 10,80) Grid
289. class used to create node Ans: GridLayout
in tree. 301. arranges the
Ans: DefaultMutableTreeNode component in rows and columns
290. dialog box is active input Ans: GridLayout
is directed to it until it is closed. 302. creates a dropdown
Ans: Model list of textual entries
291. is the Superclass of Ans: Choice
TextField andthe TextArea classes: 303. this is constructor
Ans: TextComponent of List control
292. Positions are the Ans: List(intnumRows, boolean
components into five regions east, multipleSelect)
west, north , south, center: 304. contols are
Ans: BorderLayout platform dependant
293. is a Swing class that Ans: AWT
allows the user to enter a single line
of text.
305. lays out Ans: addTab ()
components in a two dimensional 316. ………….areresponsibleforplacing
grid components on a window
Ans: GridLayout Ans: LayoutManagers
306. " AWT 317. ………………………. method is used to
component is used to create popup lock text box components.
list of string items from which only Ans: setEditable(boolean flag)
one can be selected at a time." 318. A checkbox is a control that consist
Ans: Choice of a :
307. class is used Ans: ?????
to display hierarchical data. 319. Most Swing components are
Ans: JTree components because
308. class creates they are rendered and drawn
blank sementics free window entirely by Java code.
Ans: Canvas Ans: lightweight
309. is not a
Swing Component
Ans: CheckboxGroup
310. is the
defaultlayoutmanagerfor APPLET.

Ans: FlowLayout
311. class
encapsulates AWT events.
Ans: AWTEvent
312. Constructs a new scroll bar with
the specified orientation.
Ans: Scrollbar(int)
313. component may have different size
rows may have different number of
columns.
Ans: GridLayout
314. method is used to append the
string str to end of the current text.
Ans: append ()
315. method is used to add a tab to the
pane.

You might also like