Assignment Solution 8
Assignment Solution 8
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.
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:
HeadlessException
AWTException
FontFormatException
IllegalStateException
Correct Answer:
IllegalStateException
Detailed Solution:
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.
Correct Answer:
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:
Correct Answer:
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:
Label
Button
TextField
Checkbox
Correct Answer:
Button
Detailed Solution:
QUESTION 9:
Correct Answer:
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.
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.