Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q181: What will be displayed when the actionPerformed() method is triggered?
- A: A message dialog
- B: A new frame
- C: An updated label
- D: A file dialog
View Answer
A
Q182: How do you create a JFrame instance?
- 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
Q183: In the given example, what happens when the "+" button is clicked?
- A: The sum of two numbers is displayed
- B: The product of two numbers is displayed
- C: A message dialog appears
- D: The text fields are cleared
View Answer
A
Q184: What does the getSource() method of the ActionEvent object return?
- A: The event handler
- B: The event source
- C: The event type
- D: The event description
View Answer
B
Q185: How is the JOptionPane.showMessageDialog() method used in the provided code?
- A: To show a message dialog when an action is performed
- B: To update a text field
- C: To create a new button
- D: To display an image
View Answer
A
Q186: What layout manager is used in the provided examples?
- A: FlowLayout
- B: GridLayout
- C: BorderLayout
- D: BoxLayout
View Answer
A
Q187: In the SmallCalcApp example, what will be shown in the answer field when the "*" button is pressed?
- A: The sum of the operands
- B: The product of the operands
- C: A division result
- D: An addition result
View Answer
B
Q188: Which method is used to make a JFrame visible?
- A: setVisible(true)
- B: show()
- C: display()
- D: open()
View Answer
A
Q189: What type of event does the WindowEvent class handle?
- A: Button click events
- B: Window state changes
- C: Mouse movements
- D: Keyboard inputs
View Answer
B
Q190: Which interface is used for handling mouse motion events?
- A: MouseListener
- B: MouseMotionListener
- C: ActionListener
- D: WindowListener
View Answer
B