This set of MCQ(multiple choice questions) focuses on the Programming in Java Week 8 Solutions.
Course layout (Answers Link)
Answers COMING SOON! Kindly Wait!
Week 1: Overview of Object-Oriented Programming and Java
Programming Assignment
Week 2: Java Programming Elements
Programming Assignment
Week 3: Input-Output Handling in Java
Programming Assignment
Week 4: Encapsulation
Programming Assignment
Week 5: Inheritance
Programming Assignment
Week 6: Exception Handling
Programming Assignment
Week 7: Multithreaded Programming
Programming Assignment
Week 8: Java Applets and Servlets
Programming Assignment
Week 9: Java Swing and Abstract Windowing Toolkit
Programming Assignment
Week 10: Networking with Java
Week 11: Java Object Database Connectivity
Week 12: Interface and Packages for Software Development
NOTE: You can check your answer immediately by clicking show answer button. Programming in Java Week 8 Solutions” contains 10 questions.
Now, start attempting the quiz.
Programming in Java Week 8 Solutions
Q1. Which of the following method is/are of class button in java.awt package?
a) getLabel()
b) setLabel(String label)
c) getCurrent()
d) getItem(int index)
Answer: a), b)
Q2. Which of the following is NOT a class of java.awt package?
a) Button
b) Component
c) Dialog
d) Paint
Answer: d) Paint
Q3. Which of the following statement(s) is/are correct?
a) AWT components are platform-independent
b) AWT follows the MVC (Model View Controller)
c) Swing components are platform-dependent
d) Swing follows MVC (Model View Controller)
Answer: d) Swing follows MVC (Model View Controller)
Q4. When we invoke repaint() for a java.awt.Component object, the AWT invokes which of the following method?
a) draw()
b) show()
c) update()
d) paint()
Answer: c) update()
Q5. Which package provides many event classes and Listener interfaces for event handling?
a) java.awt
b) java.lang
c) java.io
d) java.util
Answer: a) java.awt
Q6. Which of the following is TRUE aabout the following GUI?
a) There is a Frame and two TextFields.
b) There is a Frame with two Labels and two non-editable TextFields.
c) There are two Labels.
d) There is a Frame with two Labels and two TextFields.
Answer: d) There is a Frame with two Labels and two TextFields.
Q7. Which of the following is TRUE regarding check box and radio button?
a) Check box is used for single selection item whereas radio button is used for multiple selection.
b) Check box is used for multiple selection item whereas radio button is used for single selection.
c) Both are used for multiple as well as single item selection.
d) Check box is always preferred than radio buttons.
Answer: b) Check box is used for multiple selection item whereas radio button is used for single selection.
Q8. Which of the following is TRUE about check box in Java?
a) A check box can be in either an “on” (true) or “off” (false) state.
b) Clicking on a check box changes its state from “on” to “off”, or from “off” to “on”.
c) A check box can be in an “on” (true) and in “off” (false) state simultaneously.
d) Check boxes cannot be grouped together.
Answer: a), b)
Q9. Which of the following is the latest graphics and media package for Java?
a) Applet
b) AWT
c) Swing
d) JavaFX
Answer: d) JavaFX
Q10. If setText(String text) is a method of Label class, then why it is called non editable?
a) Becuase user-input is unavailable during runtime.
b) A Label is just a TextField with non-editable property turned on.
c) Labels are editable by default.
d) setText(String text) is not a method of Label class.
Answer: a) Becuase user-input is unavailable during runtime.
Programming in Java Week 8 Solutions
Q1. Which of the following is NOT a class of java.awt package?
a) Button
b) Component
c) Dialog
d) Paint
Answer: d) Paint
Q2. Which of the following is/are NOT an exception of java.awt package?
a) AWTError
b) AWTException
c) FontFormatException
d) all of these
Answer: a) AWTError
Q3. Which of the following method is/are a class button of java.awt package?
a) paint(Graphics g)
b) setLabel(String label)
c) getCurrent()
d) getIntern(int index)
Answer: b) setLabel(String label)
Q4. Which of the following container does not contain titlebar and menubar?
a) window
b) panel
c) container
d) frame
Answer: b) panel
Q5. Which package provides many event classes and Listener interfaces for event handling?
a) java.awt.activeevent
b) java.awt.event
c) java.awt.listener
d) none of these
Answer: b) java.awt.event
Q6. What is the name of the method used to get the current fond of an graphic in java.awt.graphics?
a) abstract FontMetrics getFontMetrices(Font f)
b) abstract Font getFont()
c) FontMetrices getFontMetrics()
d) None of these
Answer: b) abstract Font getFont()
Q7. Which of the following method remove all items from scrolling list in java.awt.list?
a) hide()
b) clear()
c) remove()
d) None
Answer: b) clear()
Q8. Which of the following statement is true about the update() in java.awt.package?
a) Sets the color of the graphics context to be the foreground color of this component
b) Calls this component’s paint method to completely redraw this component
c) Clears this component by filling it with the background color
d) All of these
Answer: d) All of these
Q9. Which of the following methods can be used to return the current size of a java.awt.Component object?
a) dimension()
b) setSize()
c) area()
d) size()
e) resize()
Answer: d) size()
Q10. When we invoke update() for a java.awt.Component object, the AWT invokes which of the following method?
a) show()
b) draw()
c) paint()
d) repaint()
Answer: c) paint()
>> Next- Programming in Java Week 7 Assignment Solutions
>> Next- Programming in Java Week 9 Assignment Solutions
DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.
For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.