24a - w09 - MCQ - Final
24a - w09 - MCQ - Final
PROGRAMMING IN JAVA
Assignment 9
TYPE OF QUESTION: MCQ
Number of questions: 10 Total marks: 10 × 1 = 10
QUESTION 1:
Which of the following is a one‐line input field that allows the user to choose a number or an object
value from an ordered sequence?
a. JTextarea
b. Jtex ield
c. Jspinner
d. Jslider
Correct Answer:
c. Jspinner
A JSpinner is a one‐line input field that allows the user to choose a number or an object value from an
ordered sequence.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 2:
import javax.swing.*;
Correct Answer:
By default, the layout of the content pane in a JFrame is BorderLayout. Bu on OK is placed in the center
of content pane, then bu on Cancel is placed in the same place. So you only can see bu on Cancel.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 3:
Which of the following is a container for other components and is used to build bespoke panels for
organizing and arranging components?
a. JPanel
b. JFrame
c. JCombo
d. JBox
Correct Answer:
a. JPanel
JPanel is a container for other components and is used to build bespoke panels for organizing and
arranging components.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 4:
Which of the following component gives a drop‐down list of options from which to choose?
a. JPanel
b. JBu on
c. JComboBox
d. Jbox
Correct Answer:
c. JComboBox
QUESTION 5:
Which of the following Swing components inherently support the WindowListener interface?
c. None of these
Correct Answer:
Swing frames (JFrame) and Swing dialogs (JDialog) Swing components inherently
support the WindowListener interface.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 6:
Which class in Swing provides a graphical way to display images, icons, or custom graphics?
a. JImage
b. JLabel
c. JImageIcon
d. JDialog
Correct Answer:
b. JLabel
QUESTION 7:
b. None of these
Correct Answer:
We can create a frame component by crea ng the object of Frame class (associa on) and by extending
Frame class (inheritance).
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 8:
Which method is used to set the graphics current color to the specified color in the graphics class?
Correct Answer:
The method used to set the graphics current color to the specified color in the Graphics class is:
public abstract void setColor(Color c).
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 9:
Correct Answer:
The keydown and keyup are the keyboard events are fired when the user presses or releases a key on
the keyboard. They are generated for modifier keys, func on keys, and alphanumeric keys.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 10:
a. UseLayeout()
b. setLayout()
c. layout()
d. DesignLayout()
Correct Answer:
b. setLayout()