Professional Documents
Culture Documents
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: A) `FlowLayout`
Options:
- A) Labels
- B) Push buttons
- C) Checkboxes
- D) Choice lists
Options:
- A) `Menu`
- B) `Button`
- C) `Label`
- D) `Checkbox`
Answer: A) `Menu`
1|Page
UNIT 1
Options:
- A) Small box and a Label
- B) Radio button
- C) Dropdown list
- D) Text box
5. A Frame's _______________ designates the area of the frame excluding the title, menu bar,
and the border.
Options:
- A) `ContentPane`
- B) `BorderPane`
- C) `MainPane`
- D) `Panel`
Answer: A) `ContentPane`
Options:
- A) Graphical User Instruction
- B) Graphical User Interface
- C) General Use Interaction
- D) Graphic Understanding Interface
2|Page
UNIT 1
Options:
- A) `Checkbox`
- B) `MenuItem`
- C) `Button`
- D) All of these
Options:
- A) Editable text
- B) Non-editable text
- C) Images only
- D) Both text and images
9. A ScrollPane is _______________
Options:
- A) Control
- B) Container
- C) Panel
- D) Layout
Answer: B) Container
3|Page
UNIT 1
10. A superclass of `TextField` and `TextArea` classes that is used to create single-line, multiline
text fields respectively is_____
Options:
- A) `TextComponent`
- B) `TextInput`
- C) `TextFrame`
- D) `TextPane`
Answer: A) `TextComponent`
Options:
- A) `JTabbedPane`
- B) `JFolderComponent`
- C) `FileCabinet`
- D) `FolderPanel`
Answer: A) `JTabbedPane`
Options:
- A) Display Manager
- B) Component Organizer
- C) Layout Manager
- D) Container Manager
4|Page
UNIT 1
13. A ____________ is a passive AWT control which does not generate any event.
Options:
- A) `Button`
- B) `Label`
- C) `Checkbox`
- D) `TextField`
Answer: B) `Label`
14. A ____________________ component is a display area for a short string of text, image, or
both.
Options:
- A) `TextDisplay`
- B) `DisplayPane`
- C) `TextLabel`
- D) `JLabel`
Answer: D) `JLabel`
15. All Components on Container can be removed by calling the following method
Options:
- A) `remove()`
- B) `deleteAll()`
- C) `clear()`
- D) `removeAll()`
Answer: D) `removeAll()`
5|Page
UNIT 1
Options:
- A) `java.awt`
- B) `javax.swing`
- C) `java.swing`
- D) `awt.swing`
Answer: B) `javax.swing`
Options:
- A) `Parent`
- B) `Child`
- C) `Superclass`
- D) `Subclass`
Answer: D) `Subclass`
Options:
- A) Text-based
- B) Graphics-based
- C) Both text-based and graphics-based
- D) Neither text-based nor graphics-based
6|Page
UNIT 1
Options:
- A) `lib`
- B) `bin`
- C) `jdk`
- D) `jre`
Answer: B) `bin`
20 .Which layout manager ensures that only one component is visible at a time?
Options:
A) FlowLayout
B) BorderLayout
C) GridLayout
D) CardLayout
Answer: D) CardLayout
Options:
A) Panel
B) Container
C) Frame
D) Component
Answer: D) Component
7|Page
UNIT 1
Options:
A) java.awt
B) javax.swing
C) java.awt.event
D) java.util
Answer: A) java.awt
Options:
Options:
A) java.awt.event
B) java.awt
C) java.util
D) javax.swing
Answer: A) java.awt.event
8|Page
UNIT 1
Options:
A) JList
B) JTree
C) JTable
D) JComboBox
Answer: B) JTree
Options:
A) ScrollPane
B) Panel
C) Frame
D) Canvas
Answer: A) ScrollPane
Options:
A) three
B) four
C) five
D) six
Answer: C) five
9|Page
UNIT 1
Options:
A) three
B) four
C) five
D) six
Answer: C) five
Options:
A) Left
B) Right
C) Center
D) Top
Answer: C) Center
Options:
A) 5
B) 10
C) 15
D) 20
Answer: B) 10
10 | P a g e
UNIT 1
Options:
- A) `Titlebar, borders, resizing corners`
- B) `Titlebar, menu bar, status bar`
- C) `Borders, content area, menu bar`
- D) `Content area, status bar, resizing corners`
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: A) `FlowLayout`
33. By which method can you set or change the text in a Label?
Options:
- A) `setText()`
- B) `changeText()`
- C) `setLabel()`
- D) `updateText()`
Answer: A) `setText()`
11 | P a g e
UNIT 1
Options:
- A) `Component`
- B) `Window`
- C) `Container`
- D) `Panel`
Answer: A) `Component`
35. Checkable menu items are created using an object of which class?
Options:
- A) `CheckboxMenuItem`
- B) `JMenuItem`
- C) `Menu`
- D) `PopupMenu`
Answer: A) `CheckboxMenuItem`
Options:
- A) `BorderLayout b = new BorderLayout(3,4);`
- B) `FlowLayout is a default layout for JPanel.`
- C) `JButton is a subclass of AbstractButton.`
- D) `JFrame is a subclass of Window.`
12 | P a g e
UNIT 1
Options:
- A) `TextField and Dropdown List`
- B) `Button and List`
- C) `Label and List`
- D) `TextArea and Dropdown List`
Options:
- A) `ContentPane`
- B) `MenuPane`
- C) `FramePane`
- D) `PanelPane`
Answer: A) `ContentPane`
Options:
- A) `JSeparator()`
- B) `JSeparator(int orientation)`
- C) `Both i and ii`
- D) `None of the above`
13 | P a g e
UNIT 1
Options:
- A) `Component`
- B) `JComponent`
- C) `Window`
- D) `Panel`
Answer: A) `Component`
Options:
- A) `TabbedPane, Table`
- B) `JTabbedPane, JTable`
- C) `ScrollPane, JTable`
- D) `JScrollPane, JTable`
Options:
- A) `getText()`
- B) `getCurrentText()`
- C) `retrieveText()`
- D) `fetchText()`
Answer: A) `getText()`
14 | P a g e
UNIT 1
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: B) `BorderLayout`
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: A) `FlowLayout`
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: B) `BorderLayout`
15 | P a g e
UNIT 1
Options:
- A) `FlowLayout`
- B) `BorderLayout`
- C) `GridLayout`
- D) `CardLayout`
Answer: B) `BorderLayout`
Options:
- A) `Horizontal`
- B) `Vertical`
- C) `Diagonal`
- D) `Circular`
Answer: A) `Horizontal`
48. Double-buffering built-in, tool tips, dockable toolbars, keyboard accelerators, custom
cursors, etc. are new features of _______?
Options:
- A) `AWT`
- B) `Swing`
- C) `JFrame`
- D) `JComponent`
Answer: B) `Swing`
16 | P a g e
UNIT 1
Options:
- A) `Pop-up`
- B) `Drop-down`
- C) `Roll-out`
- D) `Pull-down`
Answer: B) `Drop-down`
Options:
- A) `the LayoutManager interface`
- B) `the Container interface`
- C) `the Component interface`
- D) `the Swing interface`
Options:
- A) `.exe`
- B) `.jar`
- C) `.class`
- D) `.app`
Answer: C)
17 | P a g e
UNIT 1
Options:
- A) Modal type
- B) Modeless type
- C) Resizable type
- D) Non-modal type
Options:
- A) Left to Right
- B) Right to Left
- C) Top to Bottom
- D) Bottom to Top
Options:
- A) `FlowLayout.LEFT`
- B) `FlowLayout.RIGHT`
- C) `FlowLayout.BASELINE`
- D) `FlowLayout.CENTER`
Answer: C) `FlowLayout.BASELINE`
18 | P a g e
UNIT 1
Options:
- A) `java.awt` package
- B) `java.swing` package
- C) `java.util` package
- D) `java.io` package
Options:
- A) `addElement()`
- B) `addControl()`
- C) `addObject()`
- D) `add()`
Answer: D) `add()`
Options:
- A) `java.awt`
- B) `javax.swing`
- C) `java.util`
- D) `java.io`
Answer: B) `javax.swing`
19 | P a g e
UNIT 1
58. Frame is a standard window, which is ____________________ of Window class from AWT
hierarchy
Options:
- A) superclass
- B) subclass
- C) child class
- D) parent class
Answer: B) subclass
Options:
- A) `JFrame`
- B) `JApplet`
- C) `JPanel`
- D) `JWindow`
Answer: B) `JApplet`
Options:
- A) `CheckboxGroup`
- B) `Checkbox`
- C) `CheckboxMenuItem`
- D) `CheckboxGroup`
Answer: A) `CheckboxGroup`
20 | P a g e
UNIT 1
61. How can the Checkbox class be used to create a radio button in AWT?
Options:
- A) By associating Checkbox objects with a CheckboxGroup
- B) By setting the Checkbox's style to "Radio"
- C) By using Checkbox directly, it cannot be used to create a radio button
- D) By using a special constructor for Checkbox for radio button creation
62. How do you change the current layout managers for a container?
Options:
- A) Use the setLayout() method
- B) Use the addLayout() method
- C) Use the changeLayout() method
- D) Use the modifyLayout() method
Options:
- A) Single
- B) Double
- C) Multiple
- D) Unlimited
Answer: C) Multiple
21 | P a g e
UNIT 1
Options:
- A) Using setImage() method
- B) Using setIcon() method
- C) Using setImageIcon() method
- D) Using addButtonImage() method
65. How would you set the color of a graphics context called g to cyan?
Options:
- A) `g.setColor(Color.cyan);`
- B) `g.setCyanColor();`
- C) `g.setColor(cyan);`
- D) `g.setRGBColor(0, 255, 255);`
Answer: A) `g.setColor(Color.cyan);`
Options:
- A) `Font(String name, int size)`
- B) `Font(int style, int size)`
- C) `Font(String name, int style, int size)`
- D) `Font(int style, int size, String name)`
22 | P a g e
UNIT 1
Options:
- A) `Checkbox()`
- B) `Checkbox(String label)`
- C) `Checkbox(String label, boolean state)`
- D) `None of Above`
68. In applet, which of the following tag is used for accepting user-defined parameter?
Options:
- A) `<param>`
- B) `<app-param>`
- C) `<user-param>`
- D) `<input>`
Answer: A) `<param>`
Options:
- A) Radio buttons
- B) Checkboxes
- C) Both Checkbox and Radio buttons
- D) Menus
23 | P a g e
UNIT 1
Options:
- A) Checkbox
- B) CheckboxGroup
- C) RadioButton
- D) ButtonGroup
Answer: B) CheckboxGroup
Options:
- A) `5 pixels`
- B) `10 pixels`
- C) `15 pixels`
- D) `20 pixels`
Answer: A) `5 pixels`
72. In Graphics class, Which method is used to set the graphics current color to the specified
color?
Options:
- A) `public abstract void setColor(Color c)`
- B) `public void setCurrentColor(Color c)`
- C) `public void setDrawingColor(Color c)`
- D) `public void assignColor(Color c)`
24 | P a g e
UNIT 1
Options:
- A) `Only one way`
- B) `Two ways`
- C) `Three ways`
- D) `All of the above`
Options:
- A) `AbstractButton`
- B) `JButton`
- C) `Button`
- D) `JComponent`
Answer: A) `AbstractButton`
Options:
- A) `getContent()`
- B) `getContentPane()`
- C) `fetchContentPane()`
- D) `retrieveContent()`
Answer: B) `getContentPane()`
25 | P a g e
UNIT 1
76. In Swing, ____________ is a component that displays rows and columns of data.
Options:
- A) `JTable`
- B) `JPanel`
- C) `JGrid`
- D) `JTextArea`
Answer: A) `JTable`
Options:
- A) `JPanel`
- B) `JTable`
- C) `JScrollPane`
- D) `JGrid`
Answer: B) `JTable`
Options:
- A) `MenuItem()`
- B) `MenuItem(String Itemname)`
- C) `MenuItem(int ItemID)`
- D) `MenuItem(String Itemname, boolean enabled)`
26 | P a g e
UNIT 1
Options:
- A) `addItem()`
- B) `addObject()`
- C) `addElement()`
- D) `addItemToList()`
Answer: A) `addItem()`
Options:
- A) `Applet`
- B) `JFrame`
- C) `JWindow`
- D) `Container`
Answer: A) `Applet`
81. Java supports input/output of data through the classes included in the _______ package:
Options:
- A) `Java.io`
- B) `Java.util`
- C) `Java.awt`
- D) `Java.net`
Answer: A) `Java.io`
27 | P a g e
UNIT 1
Options:
- A) `heavyweight`
- B) `lightweight`
- C) `system`
- D) `standard`
Answer: B) `lightweight`
Options:
- A) `AbstractButton`
- B) `JButton`
- C) `RadioButton`
- D) `ButtonGroup`
Answer: A) `AbstractButton`
Options:
- A) `java.awt`
- B) `java.swing`
- C) `javax.awt`
- D) `javax.swing`
Answer: D) `javax.swing`
28 | P a g e
UNIT 1
Options:
- A) `javax.swing.tree`
- B) `java.awt.tree`
- C) `java.swing`
- D) `javax.swing`
Answer: A) `javax.swing.tree`
86. List can be created for multiple selection by using the following constructor.
Options:
- A) `List(int num, boolean multiselect)`
- B) `List(boolean multiselect)`
- C) `List(int num)`
- D) `List()`
Options:
- A) `topmost`
- B) `middle`
- C) `bottom most level`
- D) `side component`
29 | P a g e
UNIT 1
Options:
- A) `ClickEvent`
- B) `MouseActionEvent`
- C) `MouseEvent`
- D) `MouseClickEvent`
Answer: C) `MouseEvent`
Options:
- A) `Node`
- B) `Mutable`
- C) `TreeNode`
- D) `MutableNode`
Answer: C) `TreeNode`
Options:
- A) `Model-View-Control`
- B) `Model-View-Component`
- C) `Model-View-Coding`
- D) `Model-Visual-Control`
Answer: A) `Model-View-Control`
30 | P a g e
UNIT 1
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
Options:
- A) `Window`
- B) `JFrame`
- C) `Dialog`
- D) `Frame`
Answer: B) `JFrame`
Options:
- A) `Server side`
- B) `Client side`
- C) `Local side`
- D) `Remote side`
Options:
- A) `java.awt`
- B) `java.swing`
- C) `java.util`
- D) `java.io`
Answer: A) `java.awt`
31 | P a g e
UNIT 1
Options:
- A) `A lightweight container`
- B) `A heavyweight container`
- C) `Both A and B`
- D) `None of the above`
Options:
- A) `Rendering`
- B) `Grouping`
- C) `Layout`
- D) `Displaying`
Answer: B) `Grouping`
Options:
- A) `Swing`
- B) `AWT`
- C) `JRE`
- D) `JVM`
Answer: A) `Swing`
32 | P a g e
UNIT 1
97. Positions the components into five regions: east, west, north, south, center
Options:
- A) `GridLayout`
- B) `BorderLayout`
- C) `FlowLayout`
- D) `CardLayout`
Answer: B) `BorderLayout`
Options:
- A) `AppletLoader`
- B) `AppletRunner`
- C) `AppletExecutor`
- D) `Appletviewer`
Answer: D) `Appletviewer`
Options:
- A) `Menu`
- B) `MenuBar`
- C) `MenuItem`
- D) `MenuComponent`
Answer: D) `MenuComponent`
33 | P a g e
UNIT 1
Options:
- A) `Vertical`
- B) `Horizontal`
- C) `Both Vertical and Horizontal`
- D) `None of the above`
Answer: A) `Vertical`
Options:
- A) `FileDialog(Frame parent)`
- B) `FileDialog(String title, int mode)`
- C) `FileDialog(Dialog parent, String title, int mode)`
- D) `FileDialog()`
Options:
- A) `addComponent(Component comp)`
- B) `addToApplet(Component comp)`
- C) `add(comp)`
- D) `add(Component comp)`
34 | P a g e
UNIT 1
Options:
- A) `Container`
- B) `JFrame`
- C) `JComponent`
- D) `JLabel`
Answer: C) `JComponent`
Options:
- A) `Menu`
- B) `MenuBar`
- C) `Frame`
- D) `Window`
Answer: C) `Frame`
Options:
- A) `True - False`
- B) `False - True`
- C) `True - True`
- D) `False - False`
35 | P a g e
UNIT 1
Options:
- A) `Heavyweight and platform-specific`
- B) `Lightweight and platform-independent`
- C) `Heavyweight and platform-independent`
- D) `Lightweight and platform-specific`
107. Swing is the set of ____________ that provides more powerful & flexible components
compared to AWT.
Options:
- A) `Interfaces`
- B) `Classes`
- C) `Modules`
- D) `Methods`
Answer: B) `Classes`
Options:
- A) `Text Box`
- B) `Entry Field`
- C) `Edit Control`
- D) `Input Area`
36 | P a g e
UNIT 1
Options:
- A) `Multi-Line text-entry area`
- B) `Single-Line text-entry area`
- C) `Displaying images`
- D) `Creating tables`
Options:
- A) `java.awt`
- B) `java.applet`
- C) `javax.swing`
- D) `java.util`
Answer: B) `java.applet`
111. The AWT container is an instance of the ___________ class which holds various
components and other containers
Options:
- A) `Component`
- B) `Window`
- C) `Container`
- D) `JContainer`
Answer: C) `Container`
37 | P a g e
UNIT 1
112. The CardLayout class manages the components in such a manner that
Options:
- A) `Only one component is visible at a time`
- B) `Multiple components are visible at a time`
- C) `Components are displayed randomly`
- D) `Components are arranged in a stack`
113. The concept of the menu bar can be implemented using three Java classes—
Options:
- A) `MenuBar, Menu, MenuItem`
- B) `JMenuBar, JMenu, JMenuItem`
- C) `Menu, MenuBar, MenuItem`
- D) `JMenu, JMenuItem, JMenuBar`
Options:
- A) `(1, 1)`
- B) `(0, 0)`
- C) `(10, 10)`
- D) `(x, y)`
38 | P a g e
UNIT 1
Options:
- A) `Component-Container-Panel`
- B) `Container-Component-Panel`
- C) `Panel-Container-Component`
- D) `Panel-Component-Container`
Answer: A) `Component-Container-Panel`
116. The default layout manager for the content pane of a Swing-based applet is
Options:
- A) `GridLayout`
- B) `BorderLayout`
- C) `FlowLayout`
- D) `CardLayout`
Answer: B) `BorderLayout`
117. The following specifies the advantages of Swing: It is lightweight. It supports pluggable
look and feel. It follows MVC (Model View Controller) architecture.
Options:
- A) `True`
- B) `False`
Answer: A) `True`
39 | P a g e
UNIT 1
Options:
- A) `Outlined circle`
- B) `Outlined square`
- C) `Outlined rectangle`
- D) `Outlined triangle`
119. The method `setLabel` can be used with what type of Object?
Options:
- A) `Button`
- B) `Label`
- C) `TextField`
- D) `TextArea`
Answer: B) `Label`
120. The method _______________ creates an IconImage for the file `c:\image\us.gif`.
Options:
- A) `new Image("c:\image\us.gif")`
- B) `new ImageIcon("c:\image\us.gif")`
- C) `createIconImage("c:\image\us.gif")`
- D) `setIconImage("c:\image\us.gif")`
40 | P a g e
UNIT 1
121. The method `setBackground()` is part of the following class in the `java.awt` package:
Options:
- A) `Component`
- B) `Container`
- C) `Window`
- D) `JComponent`
Answer: A) `Component`
122. The string parameter to the `JButton` constructor tells what text will appear on the button.
Options:
- A) `True`
- B) `False`
Answer: A) `True`
123. The Swing component classes that are used to encapsulate a mutually exclusive set of
buttons are?
Options:
- A) `ButtonGroup`
- B) `RadioButtonGroup`
- C) `ToggleButtonGroup`
- D) `CheckGroup`
Answer: A) `ButtonGroup`
41 | P a g e
UNIT 1
Options:
- A) `drawRect(int x, int y, int width, int height)`
- B) `drawRect(int top, int left, int width, int height)`
- C) `drawRect(int width, int height)`
- D) `drawRect(int x, int y)`
Options:
- A) `Multi-line text`
- B) `Single-line text`
- C) `Formatted text`
- D) `Complex text`
Options:
- A) `TabbedPane, Table`
- B) `Menu, Scrollbar`
- C) `Checkbox, TextField`
- D) `All of these`
42 | P a g e
UNIT 1
127. The ___________ arranges components in rows and columns and makes all components the
same size.
Options:
- A) `FlowLayout manager`
- B) `GridLayout manager`
- C) `BorderLayout manager`
- D) `CardLayout manager`
Options:
- A) `CheckBoxGroup`
- B) `RadioButton`
- C) `Checkbox`
- D) `ButtonGroup`
Answer: D) `ButtonGroup`
43 | P a g e
UNIT 1
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)
- Options:
- A) `Component class`
- B) `Container class`
- C) `Panel class`
- D) `Frame class`
- Answer: A) `Component class`
139. To create a window with a title bar which of the following class is used?
- Options:
- A) `Panel`
- B) `Dialog`
- C) `Window`
- D) `Frame`
- Answer: D) `Frame`
44 | P a g e
UNIT 1
45 | P a g e
UNIT 1
46 | P a g e
UNIT 1
Answer: C) getState()
151. What does the following line of code do? `TextField text = new TextField(10);`
A) Creates a text object with 10 rows of text.
B) Creates a text object with a limit of 10 characters.
C) Creates a text object that can hold 10 columns of text.
D) Creates a text object with a default size of 10 pixels.
Answer: C) Creates a text object that can hold 10 columns of text.
47 | P a g e
UNIT 1
154. What is the default layout manager for panels and applets?
A) BorderLayout
B) FlowLayout
C) GridLayout
D) CardLayout
Answer: B) FlowLayout
48 | P a g e
UNIT 1
158. What is the use of the following method in JDialog? `Container getContentPane()`
A) Retrieves the content pane of the dialog.
B) Sets the title of the dialog.
C) Closes the dialog window.
D) Sets the layout of the dialog.
Answer: A) Retrieves the content pane of the dialog.
159. What is the use of the third parameter in the given constructor `Scrollbar(int, int, int, int,
int)`?
A) Scrollbar length
B) Scrollbar position
C) Thumbsize
D) Scrollbar orientation
Answer: C) Thumbsize
160. What is the use of the second parameter in the given constructor `Label(String, int)`?
A) Specifies the font size of the label.
B) Specifies the text color of the label.
C) Specifies the alignment of text in the label in terms of pixels.
D) Specifies the width of the label.
Answer: C) Specifies the alignment of text in the label in terms of pixels.
161. What layout manager should you use so that every component occupies the same size in the
container?
A) BorderLayout
B) FlowLayout
C) GridLayout
D) CardLayout
Answer: C) GridLayout
49 | P a g e
UNIT 1
162. What letter precedes Swing component names that have a corresponding AWT component?
A) A
B) J
C) S
D) W
Answer: B) J
163. What method is used to prevent a user from changing the size of a Frame() object?
A) setResizable(false)
B) setMovable(false)
C) setSizable(false)
D) setSizeLocked(true)
Answer: A) setResizable(false)
164. What methods are used to get and set the text label displayed by a Button object?
A) getLabel() and setLabel()
B) getText() and setText()
C) getTitle() and setTitle()
D) getValue() and setValue()
Answer: C) dispose()
50 | P a g e
UNIT 1
166. When the layout manager is disabled, which method is used to determine the shape and
position of the Component?
A) setLocation()
B) setBounds()
C) setPosition()
D) resize()
Answer: B) setBounds()
167. When we invoke repaint() for a java.awt.Component object, the AWT invokes the method:
A) update()
B) refresh()
C) redraw()
D) paint()
Answer: A) update()
Answer: A) `setVisible(true)`
169. Which package do we need to import while writing a Swing `JRadioButton` class?
A) `java.awt`
B) `javax.swing.event`
C) `javax.swing`
D) `java.util`
Answer: C) `javax.swing`
51 | P a g e
UNIT 1
Answer: C) `MenuComponent`
Answer: A) `RadioButton`
52 | P a g e
UNIT 1
Answer: A) `Label`
Answer: A) `TextArea`
176. Which class can be used to represent a checkbox with a textual label that can appear in a
menu?
A) `CheckboxMenuItem`
B) `JCheckBoxMenuItem`
C) `MenuCheckbox`
D) `MenuItemCheckbox`
Answer: A) `CheckboxMenuItem`
53 | P a g e
UNIT 1
Answer: D) `DefaultMutableTreeNode`
Answer: A) `Frame`
179. Which class encapsulates a blank window upon which we can draw?
A) `Frame`
B) `Dialog`
C) `Canvas`
D) `Window`
Answer: C) `Canvas`
Answer: A) `java.awt.AWTEvent`
54 | P a g e
UNIT 1
181. Which class is used to create a pop-up list of items from which the user may choose?
A) `PopupList`
B) `Choice`
C) `List`
D) `ComboBox`
Answer: B) `Choice`
Answer: A) `Dimension`
183. Which class is used to represent a single-line textbox with password character facility?
A) `PasswordField`
B) `TextInputField`
C) `TextPassword`
D) `TextField`
Answer: A) `PasswordField`
Answer: A) `java.awt.Graphics`
55 | P a g e
UNIT 1
Answer: A) `JFrame`
Answer: B) `JTree`
Answer: C) `JTable`
Answer: B) `list
56 | P a g e
UNIT 1
Answer: A) Frame
Answer: A) ScrollPane
57 | P a g e
UNIT 1
194. Which control in Swing is a combination of a text field and a dropdown list?
A) JComboBox
B) JList
C) JComboField
D) JTextArea
Answer: A) JComboBox
195. Which is the correct method for adding a button component into the North region of
BorderLayout? Assume `b1` as a button object.
A) `add(b1, BorderLayout.NORTH)`
B) `set(b1, BorderLayout.NORTH)`
C) `insert(b1, BorderLayout.NORTH)`
D) `place(b1, BorderLayout.NORTH)`
Answer: A) BorderLayout
58 | P a g e
UNIT 1
Answer: C) TextComponent
59 | P a g e
UNIT 1
Answer: A) Panel
202. Which method is used to count the number of items in the list?
A) `getCount()`
B) `getItemCount()`
C) `countItems()`
D) `getItemsCount()`
Answer: B) `getItemCount()`
204. Which are the various methods of the TextField control from the following?
A) `getText()`, `setText()`, `setEchoChar()`
B) `getValue()`, `setValue()`, `setText()`
C) `setValue()`, `setChar()`, `setInput()`
D) `getText()`, `setValue()`, `setChar()`
60 | P a g e
UNIT 1
205. Which layout arranges the components as a deck of cards such that only one component is
visible at a time?
A) BorderLayout
B) FlowLayout
C) CardLayout
D) GridLayout
Answer: C) CardLayout
206. Which layout should you use to organize the components of a container in a tabular form?
A) BorderLayout
B) FlowLayout
C) GridLayout
D) CardLayout
Answer: C) GridLayout
Answer: B) `init()`
208. Which method gets the text associated with Label object `jlbl`?
A) `jlbl.getText()`
B) `getText(jlbl)`
C) `jlbl.getLabelText()`
D) `getLabelText(jlbl)`
Answer: A) `jlbl.getText()`
61 | P a g e
UNIT 1
Answer: A) `addItem()`
Answer: A) `addTab()`
211. Which method is used to change the size and position of Components?
A) `setDimension()`
B) `resize()`
C) `setBounds(int x, int y, int width, int height)`
D) `setPosition()`
Answer: B) `setLabel()`
62 | P a g e
UNIT 1
Answer: C) `dispose()`
Answer: D) `setLabel()`
215. Which method is used to set the label for Button `B`?
A) `setButtonText()`
B) `setCaption()`
C) `setButtonLabel()`
D) `setLabel(String s)`
63 | P a g e
UNIT 1
Answer: A) `setLayout()`
Answer: B) `setBounds()`
Answer: C) `setVisible(true)`
220. Which object can be constructed to show and select any number of choices in the visible
window?
A) `Choice`
B) `List`
C) `ComboBox`
D) `Menu`
Answer: B) `List`
64 | P a g e
UNIT 1
221. Which of the following applet tags is legal to embed an applet class named `Test` into a Web
page?
A) `<applet code=Test.class width=200 height=100></applet>`
B) `<<applet code=Test.class width=200 height=100>></applet>`
C) `</applet code=Test.class width=200 height=100>>`
D) `<applet code=Test.class width=200 height=100></applet>`
65 | P a g e