Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Sanjivani Rural Education Society’s

SANJIVANI K. B. P. POLYTECHNIC
Department of Computer Technology
KOPARGAON – 423601, DIST: AHMEDNAGAR
2023-2024
Class Test: [Unit II - Swing] Date: / /2023
Name : Set: I
Roll No :

1. What is Swing in Java?

a) A type of dance. b) A GUI toolkit c) A data structure d) A database management system.

2. Which package is used for Swing components in Java?

a) java.awt b) javax.swing c) java.util d) java.io

3. Which class is the foundation for all Swing components?

a) JFrame b) JPanel c) JComponent d) JButton

4. Which Swing component is used to create a button?

a) JLabel b) JRadioButton. c) JButton d) JTextArea

5. What is the purpose of the JFrame class in Swing?

a) To create a main window b) To display images. c) To play audio files. d) To handle keyboard input

6. Which layout manager is used to arrange components in a single row or column?

a) BorderLayout b) GridLayout c) FlowLayout d) CardLayout

7. What is the event handling mechanism in Swing called?

a) ActionEvent b) EventListener c) EventQueue d) EventDispatcher

8. Which Swing component is used to display a list of items with a single selection?

a) JComboBox b) Jlist c) JTable d) JCheckBox

9. Which class is used to create a menu bar in Swing?

a) JMenuBar b) JMenu c) JMenuItem d) JPopupMenu

10. Which Swing component is used to create a tabbed pane?

a) JTabbedPane b) JTabComponent c) JTabView. d) JTabControl

11. What is the purpose of the JFileChooser class in Swing?

a) To create buttons b) To choose fonts c) To open and save files d) To draw shapes

12. Which method is used to set the text of a JLabel in Swing?

a) setText() b) setTextLabel() c) setLabel() d) setTextValue()

13. How do you make a Swing component visible on the screen?

a) setVisible(true) method. b) show() method c) display() method. d) open() method

14. Which Swing component is used to display a pop-up menu?

a) JPopupMenu. b) JMenu c) JMenuBar d) JPopup


15. How do you add components to a JFrame in Swing?

a) addComponent() method b) append() method c) insertComponent() method d) add() method

16. Which class is used to create a check box in Swing?

a) JCheckBox b) JRadioButton c) JToggleButton d) JCheckButton

17. What is the purpose of the setLayout() method in Swing?

a) To set the background color. b) To set the layout manager

c) To set the font style d) To set the component size

18. Which layout manager divides the container into five regions?

a) FlowLayout. b) GridLayout c) BorderLayout d) CardLayout

19. Which Swing component is used to create a text input field?

a) JTextArea b) JTextField c) JTextPane d) JTextEditor

20. What is the purpose of the repaint() method in Swing?

a) To close the application b) To refresh the component

c) To remove a component. d) To change the layout manager

21. Which class represents a color in Swing?

a) Color b) RGBColor c) Paint d) Brush

22. How do you set the size of a JFrame in Swing?

a) setSize() b) setDimension() c) setWidthHeight() d) setBounds()

23. Which class is used to display an image in Swing?

a) ImageDisplay b) ImageViewer. c) ImageIcon d) ImagePanel

24. Which component is used to display a tooltip when the mouse hovers over it?

a) JToolTip b) JPopup. c) JTooltipPane d) JPopupTip

25. Which layout manager is used to Perform One Operation At a time on components?

a) FlowLayout b) GridLayout . c) BorderLayout d) CardLayout

26. JApplet is ____________ with functionality when compared with Applet.

a)Rich b)Poor c)Same. d)Different

27. The Components in JApplet are added to

a) Current JApplet Class b)ContentPane. c)Both A and B d) None

28. Constructor for using Icon and Label in Swing.

a) ImageIcon b)ImageIcon(URL url) c)Both A and B d)None

29. How many Options can be selected in JRadioButton at a time?

a) Only One b) Multiple c)It is defined in the program d)Only a maximum of six

30. A tree represent a __________ view of data.

a) Structural. b)Hierchical c)Multiple d) Single


31. Which of the following alignment is not possible for JLabel ?

a) TOP. b) LEFT c) CENTER d) LEADING

32. _____ represents enterprise data and the business rules that gives access to enterprise data.

a) Model b) View. c)Controller. d)None of these.

33.In swing the event handling task is carried out by ___.

a) Model. b) View. c)Controller. d) None of these.

34.Frame class Entends Windows.

a) True. b) False.

35.Which is the container class?

a) Window b) Frame. c) Dialog. d)All of the above.

36.Following is uneditable control

a) Button. b) Textfield. c) Label. d)List.

37.JPanel and Applet use ____ as their default layout

a) FlowLayout. b)GridLayout. c) BorderLayout. d)GridBagLayout.

38.MVC stands for ____

a) Model Version Control. b) Model View Controller.

c)Mini View Controller. d)Major View Controller.

39.MVC architecture is used by swing.

a) True. b) False.

40.The Swing component classes that are used in Encapsulates a mutually exclusive set of buttons?

a)AbstractButton. b) ButtonGroup. c) JButton. d)ImageIcon.

41. What is the purpose of JTree?

a). To show data in the 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 .

42. Which of the following architecture does the swing framework use ?

a) MVC b) MVP c) Layered Architecture d) Master-slave Architecture

43. Which language is used in the swing framework?

a) JavaScript b) Java c). React d)Python

44.Which of these methods cannot be called on JLAbel object?

a)setIcon() b)getText() c)setLabel() d)setBorderLayout()

45. Which of the following is not a constructor of tree?

a)JTree(object obj[]) b)JTree(TreeNode + n) c)JTree(Vector V) d)JTree(int x)

46. Swing components are ______________ .

a)Platform dependent b)Platform independent c)Both A & B d)Platform oriented


47. In swing MVC architecture , C stands for ___________ .

a)Controller b)Container c)Class d)None of These

48. What is the return type of getText() method of JButton class?

a)Void b)String c)Character Array d)There is no such method

49. Default Orientation of progress bar is _________________ .

a)Horizontal b)Vertical c)Both A and B d)None of these

50. JTabbedPane class is present in which packages?

a)Java.awt.*; b)Javax.swing.*; c)Java.io.*; d)Java.util.*;

51. Swing is based on ______________ architecture.

a)Client Server b)Model View Controller c)Layered d)None of these

52. MVC architecture is used by Applet?

a)True b)False c)Both A and B d)None of these

53. Swing Components are _____________ .

a) Light b)Moderate c)Heavy d)All of the above

54. Which class encapsulates an icon .

a) Image b)Icon c)IconImage d)ImageIcon

55. Which class represent the swing version of Applet.

a) SwingApplet b)SApplet c)JApplet d)JSApplet

56.Is Swing thread-safe?

a) Yes b)No

57.The act of turning the state of a Swing component or set of components into a stream of bytes that can be saved to a file or transferred
over a network is referred to as ____ in Swing.

a)serialisation b)Accessibility c)Localization d)Globalization

58. invokelater() method in Swing framework is ____?

a) Synchronous b)Asynchronous

59. ____ is a data transfer class that provides an easy way to transport data from the Jcomponent.

a)DataShare b)Transfer c)DataTransfer d)TransferHandler

60.In Swing, the ____ is used to render visuals and listen for events?

a)Event adapters b)Events Handler c)Event listener d)Event-Driven Thread

You might also like