1.
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 the frame 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.All swing component classes are placed in
ANS: javax.swing
17.An Applet is ______________ of Panel
ANS: subclass
18.Applet Container is used to prepare ________________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 a time
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 stands for
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.Border Layout is divided into_________regions
ANS: five
28.BorderLayout class has __________regions to add 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 has a________________________________
ANS: Titlebar,borders,resizing corners
32.By default which layout manager is set on applet
ANS: FlowLayout
33.By which method You can set or change the text in a Label?
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 class of? 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 Frame is___________________. ANS: BorderLayout
43.Default layout manager for panel is 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
47."Double-buffering built in, tool tips, dockable tool bars, keyboard accelerators, custom
cursors, etc.
48.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 arranges components 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.How many 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 specified
color?
ANS: public abstract void setColor(Color c)
73.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 can be obtained via method________
ANS: getContentPane()
76.In Swing ____________is a 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
83.JRadioButton is a subclass of________.
ANS: AbstractButton
84.JTabbedPane class is present in which package?
ANS: javax.swing
85.Jtree class comes under which package…
ANS: javax.swing
86.List can be created for multiple selection by using following constructor.
ANS: List(int num,boolean multiselect)
87.Model is the _________ of the MVC architecture.
ANS: bottom most level
88.mouse click will always generate________________ event? 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, and menus" 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 is used 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
98.Program which executes applet is known as_______
ANS: Appletviewer
99.public class MenuBar extends____________________ ANS: MenuComponent
100.Scrollbar( ) creates a ______________ scroll bar by default.
ANS: Vertical
101.Select the proper constructor of FileDialog
ANS: FileDialog(Frame parent, String boxName)
102.Select the proper syntax to addcomponent in an applet
ANS: Component add(Component comoObj)
103.setBorder() method is used to set a border for ________? ANS: Jcomponent
104.setMenuBar() method of which class…. ANS: Frame
105.State true of false i) AWT is an extended version of swing ii) Paint( ) of Applet class cannot
be overridden
ANS: i-false, ii-false
106.Swing components are-------ANS: lightweight and platform independent
107.swing is the set of ____________that provides more powerful & flexible components as
compare to AWT.
ANS: Classes
108.Text field usually called as ….ANS: edit control
109.TextField class is used for__________ ANS: Single-Line text-entry area
110.The Applet class is in ………..package ANS: java.applet
111.The AWT container is an instance of the ___________ class which holds various
components and other containers ANS: Container
112.The CardLayout class defines the following constructors:
ANS: CardLayout() // First Cardlayout(int hor, int ver) //second
113.The CardLayout class manages the components in such a manner that
____________component is visible at a time ANS: Only one
114.The concept of the menu bar canbe implemented by using three java classes—
ANS: ?????
115.The coordinate of the upper-left corner of a frame is ________. ANS: (0, 0)
116.The correct hierchy for panel is ANS: Component-Container-Panel
117.The default layout manager for the content pane of a swing based applet is
ANS: Border-Layout
118."The following specifies the advantages of
ANS: It is lightweight. It supports pluggable look and feel.
119.It follows MVC (Model View Controller) architecture." ANS: Swing
120.The method drawRect() is used to display an ___________________________
ANS: outlined rectangle
121.The method setLabel can be used with what type of Object ? ANS: TextField.
122.The method ____gets the text of the button jtb is…ANS: jtb.getText( )
123.the method _________ places a menu mu into a menu bar mb. ANS: mb.add(mu)
124.The method ______________ sets the foreground color to yellow in Jframe
ANS: f.setForeground (Color.YELLOW)
125.The method_______________creates a IconImage for file c:\image\us.gif
ANS: new ImageIcon("c:\image\us.gif&q uot;);
126.The method_____________gets the text (or caption) of the label jlbl
ANS: jlbl.getText()
127.The setBackground() method is part of the following class in java.awt package:
ANS: Component
128.The string parameter to the JButton constructor tells
ANS: what text will appear on the button
129.The Swing component classes that are used in encapsulate a mutually exclusive set of
buttons are? ANS: ButtonGroup
130.The syntax for drawRect() method is
ANS: drawRect(int top, int left, int width, int height)
131.The TextArea controls create a _____ respectively. ANS: Multi-line text
134.The __________ arranges components in rows and columns and makes all components the
same size. ANS: GridLayout manager
135.The ___________ interface is used to handle button events: ANS: ActionListener
136.The __________ class is used to create radio button in AWT
ANS: CheckboxGroup
137.The ______________ Can be used to enter or display a string ANS: textfield
138."These four methods commonly used in? 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)" ANS: Component class
139.To create window with title bar which of the following class is used? ANS: Frame
140.To create file dialog box _________ class is used ANS: FileDialog
141.To display text on the applet ______method is used. ANS: drawString()
142.To draw a line in applet, we use following method ANS: drawLine()
143.To fetch caption of button___________ method is used. ANS: getLabel( )
144.To retrieve the current state of a check box,call____________
ANS: getState()
145.To set title to the frame window___________ method is used. ANS: void setTitle(String str)
146.We can add menus to____________________ ANS: Frames
147.What are controls or components? ANS: Controls or components allow users to interact with
application
148.What are the TextCompoent ? ANS: TextField , TextArea
149.What Are The Types of Dialogbox ?
ANS: modal and Modeless Dialogbox
150.What are the variables defined in Dimension
ANS: height and width
151.What Checkbox method allows you to tell if a Checkbox is checked? ANS: getState()
152.What does the following line of code do? TextField text = new TextField(10);
ANS: Creates text object that can hold 10 columns of text.
153.What is API
ANS: Application Programming Interface
154.What is default alignment of components using FlowLayout ANS: FlowLayout.CENTER
155.what is default layout manager for panels and applets.. ANS: FlowLayout
156.What is the default layout for a dialog? ANS: BorderLayout
157.What is the difference between a TextArea and a TextField?
ANS: A TextArea can handle multiple lines of text
158.What is the minimum and maximum of JProgressBar ANS: minimum -0 Maximum -100
159.What is the use of following method in JDialog? Container getContentPane()
ANS: This method returns,a Content Pane for the JDialog.
160.What is use of 3rd parameter in given constructor Scrollbar(int,int,int,int,int) ANS:
Thumbsize
161.What is use of second parameter in given constructor Label(String,int) ANS: sepcifies the
alignment of text in label in terms of pixel
162.what layout manager should you use so that every component occupies the same size in the
container? ANS: GridLayout
163.What letter precedes Swing component names that have a corresponding AWT component?
ANS: J
164.What method is used to prevent a user from changing the size of a Frame() object?
ANS: setResizable( false )
165.What methods are used to get and set the text label displayed by a Button object?
ANS: getLabel( ) and setLabel( )
166.When DialogBox is closed which method gets called…ANS: dispose()
167.When layout manager is disabled , which method is used to determine the shape and position
of Component? ANS: setBounds
168.When we invoke repaint() for a java.awt.Component object, the AWT invokes the method:
ANS: update()
169.which method is used to set the visibility of the frame?
ANS: setVisible(true)
170.which package we need to import while writng swing JRadioButton class
ANS: import javax.swing.*;
171.Which abstract class is the super class of all menu related classes. ANS: MenuComponent
172.Which Among the below is not an AWT class
ANS: RadioButton
173.Which are the Alignment Constant of Label ?
ANS: All The Above
174.Which are the subclasses of the container class?
ANS: Windows,Panel,ScrollPane.
175.Which AWT component is not editable?
ANS: Label
176.Which AWT control is used for multi-line text entry?
ANS: TextArea
177.Which class can be used to represent a checkbox with a textual label that can appear in a
menu. ANS: CheckboxMenuItem
178.Which class creates a node in Jtree? ANS: DefaultMutableTreeNode
179.Which class defines the setSize( ) method ? ANS: Frame
180.Which class encapsulates a blank window upon which we can draw? ANS: Canvas
181.Which class is on the top of the AWT event hierarchy? ANS: java.awt.AWTEvent
182.Which class is used to create a pop- up list of items from which the user may choose?
ANS: Choice
183.Which Class is used to get dimension of an Applet? ANS: Dimension
184.Which class is used to represent a single line textbox with password character facility?
ANS: TextField
185.Which class provides many methods for graphics programming? ANS: java.awt.Graphics
186.Which componant canot be added to a container? ANS: JFrame
187.Which component displays information in hierarchical manner with parent-child
relationship? ANS: JTree
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 get following shown output Figure:-
"Enter Name Here: ANS: Label,TextField
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 for adding button component into North region of border layout?
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
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 of items in the list ANS: getItemCount()
205.Which is various methods of TextField control from following?
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 with Label object jlbl? 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 size and position of Components? ANS: void setBounds(int
x,int y,int width,int height)
213.Which method is used to change the name of a menu item
ANS: void setLabel(String newName)
214.Which method is used to close a swing frame? ANS: setDefaultCloseOperation()
215.Which method is used to display Label on checkbox? ANS: String getLabel()
216.Which method is used to set label for Button B ? ANS: B.setLabel(String s)
217.Which method is used to set the dimensions of the window.
ANS: void setSize(int newWidth, int newHeight)
218.Which method is used to set the layout of the Applet? ANS: setLayout();
219.Which method sets the size and position of a component ANS: setBounds()
220.Which method will cause a Frame to be displayed? ANS: setVisible( true)
221.Which object can be constructed to show and select any number of choices in the visible
window? ANS: List
222.Which of the following applet tags is legal to embed an applet class named Test into a Web
page? ANS: < applet code = Test.class
width = 200 height = 100> </applet>
224.Which of the following are passed as an argument to the paint( ) method? ANS: A Graphics
object
225.Which of the following are subclasses of Container Class? ANS: ScrollPane,Vector,String
226.Which of the following are subclasses of java.awt.Component? ANS: Container
227.Which of the following are true? ANS: Panel extends Container.
228.which of the following class is Derived from Container Class? ANS: Panel
229.Which of the following class act as a super class in class hierachy? ANS: Component
230.Which of the following components allow multiple selections? ANS: List
231.Which of the following components does not have visible borders? ANS: Panel
232.Which of the following contain a Menubar? ANS: A Frame
233.Which of the following controls does not support interaction with user? ANS: Label
234.Which of the following creates a List with 5 visible items and multiple selection enabled?
ANS: new List(5, true)
235.which of the following is not a AWT control. ANS: ButtonGroup
236.Which of the following is not a 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 for JCheckBox?
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 is the immidiate superclass of the MenuComponent class? ANS:
Object
247.Which of the following is true about AWT and Swing Component?
ANS: AWT Components create a process where as Swing Component 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
259.Which of the following statements is for placing the frames upper left corner to (200,100)?
ANS: frame.setLocation(200,100)
260.Which of the following swing components donot have an Icon parameter in its constructor?
ANS: JTextField
261.Which of the follwing is constructor of Jtable?
ANS: JTable(Object data[][], Object colHeads[])
262.Which of the method can be used to output a string in an applet? ANS: drawString()
263.Which of the method Choice class returns a string containing the name of the item.
ANS: String getSelectedItem()
264.Which of the subclasses of java.awt.component? ANS: Container classes
266.Which of these following is not a component of swing
ANS: List
267.Which of these method cannot be called on JLabel object?
ANS: setBorderLayout()
268.Which of these methods can be used to obtain the reference to the container that generated a
ContainerEvent?
ANS: getContainer()
269.Which of these methods can be used to output a string in an applet?
ANS: drawString()
270.Which of these methods cannot be called on JLabel object?
ANS: setBorderLayout()
271.Which of these methods cannot be called on TextArea?
ANS: String getItem(int index)
272.Which of these methods is used to setting the winwods dimension ANS: void
setSize(Dimension new_size)
273.which of these methods use in cardlayout
ANS: add(String s, Component c)
274.Which of these package is used for graphical user interface ?
ANS: java.awt
275.Which of these packages contains all the classes and methods required for event handling in
Java? ANS: java.awt.event
276.Which one is the valid constructor of JCheckBox.
ANS: JCheckBox(Sting s, Icon I, Boolean State)
277.Which one method is used to set the visibility of the frame?
ANS: setVisible(true)
278.Which package use for import the swing components?
ANS: javax.swing.*;
279.Which TextComponent method is used to set a TextComponent to the read-only state?
ANS: setEditable
280.which type of button is belongs to a group such that only one button in the group may be
selected at one time?
ANS: CheckboxGroup
281.Which of these events is generated when a button is pressed?
ANS: ActionEvent
282.Why are swing component termed as lightweight ?
ANS: they do not depend on native platform
283.Why we use Applet?
ANS: Option A) and B) FROM this
284.Window is super class of____________ ANS: Frame
285.Window, frame and dialog use________ as their default layout. ANS: BorderLayout
286.You can construct a JTabbedPane using ____________.
ANS: new JTabbedPane()
287.You Can set the alignment of the string within the label by calling
_______________________
ANS: setAlignment()
288."You want to construct a text area that is 80 character-widths wide and 10 character-heights
tall. What code do you use ?"
ANS: new TextArea( 10,80)
289.________ class used to create node in tree.
ANS: DefaultMutableTreeNode
290.________dialog box is active input is directed to it until it is closed. ANS: Model
291._________is the Superclass of TextField and the TextArea classes: ANS: TextComponent
292._________Positions are the components into five regions east, west, north , south, center:
ANS: BorderLayout
293.__________ is a Swing class that allows the user to enter a single line of text.
ANS: JTextField
294.__________ is a Swing layout manager that arranges components in a row or a column.
ANS: GridLayout
295.__________ method is used to add items in Combobox.
ANS: addItem()
296.__________ method is used to add the menubar on frame window. ANS: setMenuBar()
297.__________ method returns currently selected item in choice.
ANS: getSelectedItem( )
298.____________ can be used to enter and display a string
ANS: A TextField
299.____________ class is used to create set of mutually exclusive checkboxes.
ANS: CheckboxGroup
300.____________ Layout lays components in a Two Dimensional Grid
ANS: GridLayout
301.____________arranges the component in rows and columns ANS: GridLayout
302.____________creates a dropdown list of textual entries
ANS: Choice
303.______________this is constructor of List control
ANS: List(int numRows, boolean multipleSelect)
304._______________contols are platform dependant
ANS: AWT
305.________________ lays out components in a two dimensional grid
ANS: GridLayout
306."________________ AWT component is used to create popup list of string items from
which only one can be selected at a time." ANS: Choice
307.________________ class is used to display hierarchical data.
ANS: JTree
308.__________________class creates blank sementics free window
ANS: Canvas
309.________________ is not a Swing Component
ANS: CheckboxGroup
310._____________________ is the default layout manager for 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.