Ajp 02 MCQ
Ajp 02 MCQ
ANS: FlowLayout
ANS: Menu
ANS: ?????
ANS: Container
10."A superclass of Textfield and TextArea classes that is used to create single-line ,
multiline textfields rexpectively is_____."
ANS: Textcomponent
ANS: JTabbedPane
13.A ____________ is a passive AWT control which do not generate any event.
ANS: Label
ANS: Jlabel
ANS: removeAll()
ANS: javax.swing
ANS: subclass
ANS: ?????
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
ANS: java.awt
ANS: Jtree
ANS: five
ANS: Five
ANS: 10
33.By which method You can set or change the text in a Label?
ANS: setText()
ANS: CheckboxMenuItem
ANS: ContentPane
ANS: TabbedPane,Table
ANS: Horizontal
47."Double-buffering built in, tool tips, dockable tool bars, keyboard accelerators, custom
cursors, etc.
ANS: FlowLayout.BASELINE
ANS: add()
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?
62.How do you change the current layout managers for a container? ANS: Use the setLayout()
method
ANS: multiple
65.How would you set the color of a graphics context called g to cyan? ANS:
g.setColor(Color.cyan);
ANS: ?????
68.In applet, which of the following tag is used for accepting user defined parameter?
ANS: Param
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: ____
ANS: AbstractButton
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
ANS: addItem()
ANS: AbstractButton
ANS: javax.swing
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
97.Positions the componenets into five regions: east, west, north, south, center
ANS: BorderLayout
ANS: Appletviewer
99.public class MenuBar extends____________________ ANS: MenuComponent
ANS: Vertical
105.State true of false i) AWT is an extended version of swing ii) Paint( ) of Applet class cannot
be overridden
107.swing is the set of ____________that provides more powerful & flexible components as
compare to AWT.
ANS: Classes
111.The AWT container is an instance of the ___________ class which holds various
components and other containers ANS: Container
114.The concept of the menu bar canbe implemented by using three java classes—
ANS: ?????
117.The default layout manager for the content pane of a swing based applet is
ANS: Border-Layout
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)
ANS: jlbl.getText()
127.The setBackground() method is part of the following class in java.awt package:
ANS: Component
129.The Swing component classes that are used in encapsulate a mutually exclusive set of
buttons are? ANS: ButtonGroup
134.The __________ arranges components in rows and columns and makes all components the
same size. ANS: GridLayout manager
ANS: CheckboxGroup
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
ANS: getState()
145.To set title to the frame window___________ method is used. ANS: void setTitle(String str)
147.What are controls or components? ANS: Controls or components allow users to interact with
application
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);
153.What is API
155.what is default layout manager for panels and applets.. ANS: FlowLayout
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()
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?
165.What methods are used to get and set the text label displayed by a Button object?
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()
ANS: setVisible(true)
ANS: RadioButton
ANS: Windows,Panel,ScrollPane.
ANS: Label
ANS: TextArea
177.Which class can be used to represent a checkbox with a textual label that can appear in a
menu. ANS: CheckboxMenuItem
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
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
ANS: JTable
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 .
203.Which is the method is used to count the number of items in the list ANS: getItemCount()
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
209.Which method gets the text associated with Label object jlbl? ANS: jlbl.getText()
212.Which method is used to change size and position of Components? ANS: void setBounds(int
x,int y,int width,int height)
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()
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
224.Which of the following are passed as an argument to the paint( ) method? ANS: A Graphics
object
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
231.Which of the following components does not have visible borders? ANS: Panel
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)
ANS: JTree(int x)
237.Which of the following is not a swing class? ANS: Canvas
242.Which of the following is not valid alignment constant for Label? ANS: MIDDLE
244.Which of the following is not valid style constant for Font? ANS: NORMAL
246.Which of the following is the immidiate superclass of the MenuComponent class? ANS:
Object
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
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
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: List
268.Which of these methods can be used to obtain the reference to the container that generated a
ContainerEvent?
ANS: getContainer()
ANS: drawString()
ANS: setBorderLayout()
272.Which of these methods is used to setting the winwods dimension ANS: void
setSize(Dimension new_size)
ANS: java.awt
275.Which of these packages contains all the classes and methods required for event handling in
Java? ANS: java.awt.event
ANS: setVisible(true)
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
ANS: ActionEvent
285.Window, frame and dialog use________ as their default layout. ANS: BorderLayout
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: DefaultMutableTreeNode
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
ANS: GridLayout
ANS: addItem()
296.__________ method is used to add the menubar on frame window. ANS: setMenuBar()
ANS: getSelectedItem( )
ANS: A TextField
ANS: CheckboxGroup
ANS: GridLayout
ANS: Choice
ANS: AWT
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
ANS: JTree
ANS: Canvas
ANS: CheckboxGroup
ANS: FlowLayout
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 ()