Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q211: Which method needs to be overridden when using WindowAdapter to handle window closing?
- A: windowClosed
- B: windowClosing
- C: windowActivated
- D: windowDeactivated
View Answer
B
Q212: What does the following code do: frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { JOptionPane.showMessageDialog(null, "Good Bye"); System.exit(0); } });
- A: Registers a WindowListener for window closing event
- B: Registers an anonymous inner class for window closing
- C: Displays a message and exits on window close
- D: None of the above
View Answer
B
Q213: When handling events in Java, which of the following is NOT a valid approach?
- A: Using an anonymous inner class
- B: Extending an Adapter class
- C: Implementing multiple interfaces in one class
- D: Using an inner class
View Answer
C
Q214: In the SmallCalcApp example, what operation does the ButtonHandler class perform when the '+' button is pressed?
- A: Subtracts two numbers
- B: Multiplies two numbers
- C: Adds two numbers
- D: Divides two numbers
View Answer
C
Q215: _______ is the process of converting a java object into Byte stream.
- A: Encapsulation
- B: Abstraction
- C: Serialization
- D: None of the above
View Answer
C
Q216: Which of these can be used to store the state of an object in a file?
- A: FileOutputStream
- B: ObjectOutputStream
- C: ObjectInputStream
- D: FileInputStream
View Answer
B
Q217: Which Java class provides empty method implementations for all methods of MouseMotionListener?
- A: MouseMotionAdapter
- B: MouseAdapter
- C: MouseListener
- D: MouseEvent
View Answer
A
Q218: How can you handle both window and mouse events in a single class while using inner classes?
- A: By using multiple inner classes
- B: By extending multiple adapter classes
- C: By implementing multiple interfaces
- D: By using both WindowAdapter and MouseMotionAdapter as inner classes
View Answer
D
Q219: What is the purpose of the java.sql package in JDBC?
- A: To handle Java GUI components
- B: To provide classes and interfaces for database interaction
- C: To manage file I/O operations
- D: To create graphical user interfaces
View Answer
B
Q220: Which JDBC driver is used for connecting to Microsoft Access databases?
- A: oracle.jdbc.driver.OracleDriver
- B: com.mysql.cj.jdbc.Driver
- C: sun.jdbc.odbc.JdbcOdbcDriver
- D: org.postgresql.Driver
View Answer
C