MCQs On 2nd
MCQs On 2nd
MCQs On 2nd
Pruthviraj D.
Vansh B.
Q 10: Which method is used to close a JFrame and terminate the application?
A) close()
B) dispose()
C) exit()
D) terminate()
Answer: B) dispose()
Shreyash Chudiwal:
Q.2 Which Java GUI toolkit offers a more modern and flexible alternative to
AWT?
a) JavaFX
b) Swing
c) SWT
d) JavaGUI
Correct answer: b
Q.7 Which Swing component provides scroll bars for viewing content that doesn't
fit within its visible area?
a) JScrollArea
b) JViewport
c) JScrollPane
d) JScrollBar
Correct answer: c
Q.8 What does MVC stand for in the context of Swing architecture?
a) Model-View-Canvas
b) Model-Viewer-Controller
c) Multi-View-Component
d) Model-View-Controller
Correct answer: d
Prashant Kalaphad:
5. A ____ is a one-line input field that allows the user to choose a number or an
object value from an ordered sequence?
JTextarea
Jtextfield
Jspinner
Jslider
Answer: C) Jspinner
6. A ____ control is a dialogue window that allows the user to pick a file?
JChoosFile
JFilefield
JFile
JFileChooser
Answer: D) JFileChooser
9) Which of the following type of events requires direct interaction with the user?
Foreground events
Background events
Answer: A) Foreground events
10. Which of the following type of events requires direct interaction with the end-
user?
Foreground events
Background events
Answer: B) Background events
Tanmay Gawali:
3. Which class is used as the base class for all Swing components?
a) Component
b) Container
c) JPanel
d) JFrame
4. Which layout manager is used by default for JFrame?
a) BorderLayout
b) FlowLayout
c) GridLayout
d) CardLayout
6. Which event listener interface is used for handling button click events?
a) ActionListener
b) ItemListener
c) MouseListener
d) KeyListener
Atharva G.
Ans:C
Answer: C. javax.swing.JComponent
Answer: D
Answer: B
Answer: D
Answer: A
Answer: B
Which of the following methods is used to display a JOptionPane dialog box?
A. showMessageDialog()
B. showInputDialog()
C. showOptionDialog()
D. showConfirmDialog()
Answer: A
Jay Bankar:
8)In Java, what do you call an area on the screen that has nice borders and various
buttons along the top border?
A. A window
B. A screen
C. A box
D. A frame
Option D
Ans--
1)c
2)a
3)b
4)c
5)c
6)c
7)d
8)c
9)b
10)a