Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q201: How many methods are there in the WindowListener interface?
- A: 5
- B: 6
- C: 7
- D: 8
View Answer
C
Q202: What is the main purpose of the initGUI() method in the examples?
- A: To initialize the GUI components and layout
- B: To handle window events
- C: To create new instances of the components
- D: To set up event handling listeners
View Answer
A
Q203: Event source can have --------- listeners registered on it.
- A: Single
- B: Double
- C: Triple
- D: Multiple
View Answer
D
Q204: Which interface must a class implement to handle window events?
- A: WindowListener
- B: WindowEventListener
- C: WindowHandler
- D: WindowEvents
View Answer
A
Q205: What does the getSource() method of the MouseEvent object return?
- A: The mouse button pressed
- B: The component that generated the event
- C: The coordinates of the mouse
- D: The type of the mouse event
View Answer
B
Q206: What is the purpose of an Adapter class in Java?
- A: To provide a default implementation of all methods in an interface
- B: To extend functionality of an existing class
- C: To handle GUI events without code clutter
- D: To create a new interface
View Answer
A
Q207: Which adapter class is used for handling window events in Java?
- A: WindowAdapter
- B: MouseAdapter
- C: ActionAdapter
- D: KeyAdapter
View Answer
A
Q208: In which scenario would you use an anonymous inner class?
- A: When an object is used multiple times
- B: For one-time use of an object
- C: To implement multiple interfaces
- D: To avoid inner class complexity
View Answer
B
Q209: Which method of the WindowListener interface is used to handle the event of closing a window?
- A: windowActivated
- B: windowClosing
- C: windowDeactivated
- D: windowOpened
View Answer
B
Q210: How do you handle mouse motion events in Java using adapter classes?
- A: By extending MouseMotionAdapter
- B: By implementing MouseMotionListener
- C: By using MouseAdapter
- D: By implementing MouseListener
View Answer
A