Unit 2 Swing Set 2
Unit 2 Swing Set 2
Unit 2 Swing Set 2
[Unit II - Swing]
2. Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?
a) True b) False
3. The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?
a) AbstractButton b) ButtonGroup c) JButton d) ImageIcon
4. The Java Foundation Classes is a set of GUI components which simplify the development of desktop applications?
a) True b) False
7. MVC architecture is
a) Modelling – Visual – Controller b) Model – View – Controller c) Model – Viewable – Controller d) Many – View – Controller
13. Which of the following method is not applicable for Button in swing.
a) setDiableIcon() b) setPressedIcon() c) setSelectedIcon() d) setRollOverIcon()
14. What is purpose of JTree?
a) To show data in form of parent and child nodes.
b) To show data in list view.
c) To show data in tabular form.
d) To show data in menu‐bar.
19. In Swing, the content pane can be obtained via the method:
a) getContentPane() b) fetchContentPane() c) retrieveContent() d) accessContent()
20. In Swing, what component is used for adding hints to other Swing components to provide additional information?
A. JToolTip B. JLabel C. JTextField D. JTabbedPane
22. In the MVC architecture, what role does the "View" play?
A. Manages application data.
B. Represents the user interface and presentation logic.
C. Handles user input and interactions.
D. None of the above.
24. Which Swing layout manager arranges components in a Square, with a specified number of rows and columns?
A. FlowLayout B. BorderLayout C. GridLayout D. CardLayout
27. Which of the following code snippets creates a Swing JButton correctly?
A) JButton button = new JButton("Click me");
B) Button button = new Button("Click me");
C) JComponent button = new JComponent("Click me");
D) Button button = new JButton("Click me");
28. Swing is a set of classes that provides more and components than are possible with the AWT
a) Powerful , Flexible b) Great, Awesome c) Better , Powerful d) Stable, customizable
40. Which of the following method is not applicable for Button in swing.
a) setDiableIcon() b) setPressedIcon() c) setSelectedIcon() d) setRollOverIcon()
41. How will you assign the string and icon both to the JButton?
a) It is not possible
b) Use the setTextIcon( ) method
c) Use the setIconText( ) method
d) Initialize them directly in the constructor
42. Which event is generated when a JButton is pushed?
a) ItemEvent b) TextEvent c) PushEvent d) ActionEvent
46. What will be the correct statement if you want a checkbox to be checked by default?
a) JCheckBox jc= new JCheckBox(String s, boolean checked)
b) JCheckBox jc= new JCheckBox(String s, boolean false)
c) JCheckBox jc= new JCheckBox(String s, boolean unchecked)
d) JCheckBox jc= new JCheckBox(String s, boolean true)
50. Which method is used to add the tabs in the tabbed pane?
a) add( ) b) addItem( ) c) addPane( ) d) addTab( )