Java Swing Multiple-Choice Questions (MCQs)

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes – an API for providing a graphical user interface for Java programs.

Java Swing MCQs: This section contains multiple-choice questions and answers on the various topics of Java Swing. Practice these MCQs to test and enhance your skills on Java Swing.

List of Java Swing MCQs

1. Which of the following architecture does the Swing framework use?

  1. MVC
  2. MVP
  3. Layered architecture
  4. Master-Slave architecture

Answer: A) MVC

Explanation:

Swing framework uses MVC architecture.

Discuss this Question


2. Which language is used in the swing framework?

  1. JavaScript
  2. Java
  3. React
  4. Python

Answer: B) Java

Explanation:

The swing framework is written in the Java programming language.

Discuss this Question


3. A ____ is the abstract foundation class for SWING's non-menu user interface controls?

  1. Container
  2. Jcomponent
  3. Component

Answer: C) Component

Explanation:

A Component is the abstract foundation class for SWING's non-menu user interface controls.

Discuss this Question


4. A ____ is the basic class for all SWING UI components?

  1. Container
  2. Jcomponent
  3. Component

Answer: B) Jcomponent

Explanation:

A JComponent is a basic class for all SWING UI components.

Discuss this Question


5. A ____ is a one-line input field that allows the user to choose a number or an object value from an ordered sequence?

  1. JTextarea
  2. Jtextfield
  3. Jspinner
  4. Jslider

Answer: C) Jspinner

Explanation:

A JSpinner is a one-line input field that allows the user to choose a number or an object value from an ordered sequence.

Discuss this Question


6. A ____ control is a dialogue window that allows the user to pick a file?

  1. JChoosFile
  2. JFilefield
  3. JFile
  4. JFileChooser

Answer: D) JFileChooser

Explanation:

A JFileChooser control is a dialogue window that allows the user to pick a file.

Discuss this Question


7. An ____ is a change in the state of an item?

  1. Spinner
  2. Event
  3. Occurrence
  4. Activity

Answer: B) Event

Explanation:

An event is a change in the state of an item.

Discuss this Question


8. How many types of events are there?

  1. 5
  2. 3
  3. 2
  4. 4

Answer: C) 2

Explanation:

There are two types of events: foreground events and background events.

Discuss this Question


9. Which of the following type of events requires direct interaction with the user?

  1. Foreground events
  2. Background events

Answer: A) Foreground events

Explanation:

Foreground events require direct interaction with the user.

Discuss this Question


10. Which of the following type of events requires direct interaction with the end-user?

  1. Foreground events
  2. Background events

Answer: B) Background events

Explanation:

Background events require direct interaction with the end-user.

Discuss this Question


11. To manage events, Java employs the ____?

  1. Custom-based Event Model
  2. Retired Event Model
  3. Delegation Event Model

Answer: C) Delegation Event Model

Explanation:

To manage events, Java employs the Delegation Event Model.

Discuss this Question


12. Which of the following function is used to generate the application's top-level window?

  1. JPanel
  2. JFrame
  3. JCombo

Answer: B) JFrame

Explanation:

JFrame is used to generate the application's top-level window.

Discuss this Question


13. ____ is a container for other components and is used to build bespoke panels for organizing and arranging components?

  1. JPanel
  2. JFrame
  3. JCombo
  4. JBox

Answer: A) JPanel

Explanation:

JPanel is a container for other components and is used to build bespoke panels for organizing and arranging components.

Discuss this Question


14. Which of the following component gives a drop-down list of options from which to choose?

  1. JPanel
  2. JButton
  3. JComboBox
  4. JBox

Answer: C) JComboBox

Explanation:

JComboBox component gives a drop-down list of options from which to choose.

Discuss this Question


15. ____ are classes that act as a connection point between event listeners and event sources?

  1. Event adapters
  2. Events Handler
  3. Event listener
  4. Jevent

Answer: A) Event adapters

Explanation:

Event adapters are classes that act as a connection point between event listeners and event sources.

Discuss this Question


16. The ____ class serves as the foundation for all Swing components.

  1. JButton
  2. JComponent
  3. JTextField

Answer: B) JComponent

Explanation:

The JComponent class serves as the foundation for all Swing components.

Discuss this Question


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

  1. Event adapters
  2. Events Handler
  3. Event listener
  4. Event-Driven Thread

Answer: D) Event-Driven Thread

Explanation:

In Swing, the Event-Driven Thread is used to render visuals and listen for events.

Discuss this Question


18. Among AWT and Swing which is platform independent?

  1. AWT
  2. Swing

Answer: B) Swing

Explanation:

Swing framework is platform independent whereas AWT is platform dependent.

Discuss this Question


19. Swing framework is ____ component?

  1. Heavyweight
  2. Lightweight

Answer: B) Lightweight

Explanation:

Swing framework is a lightweight component.

Discuss this Question


20. The ____ class enables the development of abstract functions as well as action interfaces.

  1. Action
  2. Abstraction
  3. AbstractionAction

Answer: C) AbstractionAction

Explanation:

The AbstractAction class enables the development of abstract functions as well as action interfaces.

Discuss this Question


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

  1. DataShare
  2. Transfer
  3. DataTransfer
  4. TransferHandler

Answer: D) TransferHandler

Explanation:

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

Discuss this Question


22. invokeandwait() method in Swing framework is ____.

  1. Synchronous
  2. Asynchronous

Answer: A) Synchronous

Explanation:

invokeandwait() method in the Swing framework is Synchronous.

Discuss this Question


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

  1. Synchronous
  2. Asynchronous

Answer: B) Asynchronous

Explanation:

invokelater() method in the Swing framework is Asynchronous.

Discuss this Question


24. An ____ is a short software that runs in a web browser.

  1. Application
  2. AWT
  3. Applet
  4. JFrame

Answer: C) Applet

Explanation:

An applet is a short software that runs in a web browser.

Discuss this Question


25. Is Applet and Application both are same in the swing framework?

  1. Yes
  2. No

Answer: B) No

Explanation:

An application and an applet are two sorts of Java programs with distinct features that execute in separate settings.

Discuss this Question


26. 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.

  1. serialisation
  2. Accessibility
  3. Localization
  4. Globalization

Answer: A) serialisation

Explanation:

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 serialization in Swing.

Discuss this Question


27. A ____ is a Swing framework component that offers a scroll bar that may be used to scroll content in a container.

  1. JScrollPanel
  2. JScrollBox
  3. JScroll
  4. JScrollBar

Answer: D) JScrollBar

Explanation:

A JScrollBar is a Swing framework component that offers a scroll bar that may be used to scroll content in a container.

Discuss this Question


28. A ____ is a container that provides a viewport for showing a piece of a bigger component.

  1. JScrollPanel
  2. JScrollBox
  3. JScroll
  4. JScrollPane

Answer: D) JScrollPane

Explanation:

A JScrollPane is a container that provides a viewport for showing a piece of a bigger component.

Discuss this Question


29. EDT in Swing framework stands for ____.

  1. Event Driven thread
  2. Event Determined Thread
  3. Electronic-event-driven thread

Answer: A) Event Driven thread

Explanation:

EDT stands for Event-driven thread.

Discuss this Question


30. A ____ is a type of object that organizes components in a container.

  1. Event adapter
  2. Event Handler
  3. layout manager
  4. Grid Manager

Answer: C) layout manager

Explanation:

A layout manager is a type of object that organizes components in a container.

Discuss this Question


31. The ____ function allows you to paint with a Graphics object.

  1. AllPaint()
  2. Jpaint()
  3. Repaint()
  4. paint()

Answer: D) paint()

Explanation:

The paint() function allows you to paint with a Graphics object.

Discuss this Question


32. Is Swing thread-safe?

  1. Yes
  2. No

Answer: B) No

Explanation:

No, Swing framework is not thread-safe.

Discuss this Question


33. The ____ function is used to specify the layout of a container.

  1. UseLayeout()
  2. setLayout()
  3. layout()
  4. DesignLayout()

Answer: B) setLayout()

Explanation:

The setLayout() function is used to specify the layout of a container.

Discuss this Question


34. ____ method validates the components of a container.

  1. Validate()
  2. Examine()
  3. Analyze()

Answer: A) Validate()

Explanation:

Validate() method validates the components of a container.

Discuss this Question


35. Which of the following companies are using swing framework?

  1. IBM
  2. Oracle
  3. Microsoft
  4. All of the above

Answer: D) All of the above

Explanation:

Following companies are using swing framework:

  • IBM
  • Oracle
  • Amazon
  • Google

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.