Skip to main content

Web Design and Development MCQs with Answers

Practice important Web Design and Development MCQs with answers and explanations.

Multiple Choice Questions

Q171: What is a JPanel used for in Java Swing?
  • A: To hold other components
  • B: To handle events
  • C: To manage layout of a window
  • D: To create a new window
View Answer
A

Q172: How do you create a JFrame instance in Java?
  • A: JFrame frame = new JFrame();
  • B: JFrame frame = new JFrame("Title");
  • C: JFrame frame = new JFrame("Title", true);
  • D: JFrame frame = JFrame();
View Answer
A

Q173: Which layout manager arranges components in a line by line basis?
  • A: FlowLayout
  • B: GridLayout
  • C: BorderLayout
  • D: CardLayout
View Answer
A

Q174: What method is used to set the size of a JFrame?
  • A: setSize
  • B: setDimensions
  • C: setBounds
  • D: setHeight
View Answer
A

Q175: What is the purpose of the Event Delegation Model in Java?
  • A: To process all events in one class
  • B: To delegate event processing to specific handlers
  • C: To handle events synchronously
  • D: To avoid using listeners
View Answer
B

Q176: Which package contains event listener interfaces for AWT components?
  • A: javax.swing.event
  • B: java.awt
  • C: java.swing
  • D: java.awt.event
View Answer
D

Q177: What does the ActionListener interface handle?
  • A: Mouse events
  • B: Window events
  • C: Action events
  • D: Key events
View Answer
C

Q178: What method must be implemented when a class implements ActionListener?
  • A: actionPerformed(ActionEvent e)
  • B: handleEvent(Event e)
  • C: processAction(ActionEvent e)
  • D: eventOccurred(ActionEvent e)
View Answer
A

Q179: Which class is used to create a button in Swing?
  • A: JButton
  • B: JButtonAction
  • C: Button
  • D: SwingButton
View Answer
A

Q180: What is the role of addActionListener() method in Swing?
  • A: To add a new button to the frame
  • B: To register an event handler with a button
  • C: To change the button’s text
  • D: To remove an event listener from a button
View Answer
B

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now