NPTEL Programming in Java Week 9 Assignment Answers 2024
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. Jtextfield
c. Jspinner
d. Jslider
Answer :- For Answers Click Here
2. What is true about the following code.
a. Both “OK” and “Cancel” button is added, but only “Cancel” button is visble.
b. Only “OK” button is added and visible, “Cancel” button is not added.
c. Only “Cancel” button will be added and visible, “OK” button is not added.
d. Code throws an ERROR.
Answer :- For Answers Click Here
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
Answer :- For Answers Click Here
4. Which of the following component gives a drop-down list of options from which to choose?
a. Jpanel
b. Jbutton
c. JComboBox
d. Jbox
Answer :-
5. Which of the following Swing components inherently support the WindowListener interface?
a. Swing frames (JFrame)
b. Swing checkboxes (JCheckBox)
c. None of these
d. Swing combo boxes (JComboBox)
Answer :-
6. Which class in Swing provides a graphical way to display images, icons, or custom graphics?
a. Jimage
b. Jlabel
c. JImageIcon
d. JDialog
Answer :- For Answers Click Here
7. What is/are the way(s) to create a Frame in Java Swing?
a. By creating the object of Frame class (association)
b. None of these
c. By importing a package named Jframe
d. By declaring a class with name JFrame
Answer :-
8. Which method is used to set the graphics current color to the specified color in the graphics class?
a. public abstract void setFont(Font font)
b. public abstract void setColor(Color c)
c. public abstract void drawString(String str, int x, int y)
d. None of the above
Answer :-
9. When are the keyboard events fired?
a. When the user manually calls the button
b. When the user right clicks the mouse
c. When the user calls the modifier
d. When the user clicks a key
Answer :-
10. Which of the following function is used to specify the layout of a container.
a. UseLayeout()
b. setLayout()
c. layout()
d. DesignLayout()
Answer :- For Answers Click Here