NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
NOC25-CS57 (JAN-2025 25S)
PROGRAMMING IN JAVA
Assignment 8
TYPE OF QUESTION: MCQ
Number of questions: 10 Total marks: 10 × 1 = 10
QUESTION 1:
Which of the following is TRUE regarding check box and radio button?
Check box is used for single selection item whereas radio button is used for multiple selection.
Check box is used for multiple selection items whereas radio button is used for single selection.
Both are used for multiple as well as single item selection.
Checkbox is always preferred than radio buttons.
Correct Answer:
Check box is used for multiple selection items whereas radio button is used for single selection.
Detailed Solution:
Check box is used for multiple selection items whereas radio button is used for single selection. For
example, if a form is asking for your favorite hobbies, there might be multiple correct answers to it, in
that case check box is preferred. And if a form is asking about gender, there must be only one true
option among the multiple choices, in that case radio buttons are used.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 2:
Which of the following is the latest graphics and media package for Java?
Applet
AWT
Swing
JavaFX
Correct Answer:
JavaFX
Detailed Solution:
JavaFX is a set of latest graphics and media packages in Java that enables developers to design, create,
test, debug, and deploy rich client applications that operate consistently across diverse platforms.
More details can be found here: https://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 3:
Which of the following is/are NOT an exception of java.awt package?
HeadlessException
AWTException
FontFormatException
IllegalStateException
Correct Answer:
IllegalStateException
Detailed Solution:
IllegalStateException doesnot belong to java.awt package.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 4:
Which of the following statement is FALSE about the update() in java.awt package?
Sets the color of the graphics context to be the foreground color of this component.
Calls this component's paint method to completely redraw this component.
Updates the component by checking an online repository.
Clears this component by filling it with the background color.
Correct Answer:
Updates the component by checking an online repository
Detailed Solution:
The update() function does not update the component by checking an online repository rather it, sets
the color of the graphics context to be the foreground color of this component, calls this component's
paint method to completely redraw this component and clears this component by filling it with the
background color.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 5:
Which of the following method is used to remove all items from scrolling list in java.awt.list?
hide()
remove()
clear()
close()
Correct Answer:
clear()
Detailed Solution:
The function clear() in java.awt.list is used for remove all items from scrolling list.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 6:
Which layout manager arranges components in a single row or column in Java? Commented [NP1]: no question shold be given from
applet
FlowLayout Commented [DM2R1]: changed. Thanks.
BorderLayout
GridLayout
CardLayout
Correct Answer:
FlowLayout
Detailed Solution:
The FlowLayout arranges components sequentially, either in a single row or column, based on the
available space.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 7:
What does "AWT" stand for in Java?
Abstract Widget Toolkit
Advanced Window Toolkit
Abstract Window Toolkit
Advanced Widget Toolkit
Correct Answer:
Abstract Window Toolkit
Detailed Solution:
AWT is the Java library for creating GUI components like buttons and windows.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 8:
Which AWT component is used to create a button in a GUI?
Label
Button
TextField
Checkbox
Correct Answer:
Button
Detailed Solution:
The Button class in AWT is used to create clickable buttons in a GUI.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 9:
Which of the following is TRUE about the following GUI?
There is a Frame and two TextFields.
There is a Frame with two Labels and two non-editable TextFields.
There are two Labels.
There is a Frame with two Labels and two TextFields.
Correct Answer:
There is a Frame with two Labels and two TextFields
Detailed Solution:
There is a Frame with two Labels and two TextFields in the given GUI.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 10:
Which of the following is TRUE about check box in Java? Commented [NP3]: Please only set mcq type question
(one correct answer)
A check box can’t be in either an "on" (true) or "off" (false) state.
In FINAL QP you can set MSQ
Clicking on a check box changes its state from "on" to "off," or from "off" to "on." Commented [DM4R3]: fixed
A check box can be in an "on" (true) and in "off" (false) state simultaneously.
Check boxes cannot be grouped together.
Correct Answer:
Clicking on a check box changes its state from "on" to "off," or from "off" to "on."
Detailed Solution:
A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on
a check box changes its state from "on" to "off," or from "off" to "on.". A check box cannot be in both
“on” and “off” state simultaneously. Further, several check boxes can be grouped together under the
control of a single object, using the CheckboxGroup class. In a check box group, at most one button can
be in the "on" state at any given time. Clicking on a check box to turn it on forces any other check box in
the same group that is on into the "off" state.