Java MCQs with answers Page - 30

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Which of the following is the highest class in the event delegation model?

  • (A) java.util.EventListner
  • (B) java.util.EventObject
  • (C) java.util.AWTEvent
  • (D) java.util.event.AWTEvent

A

Admin • 833.24K Points
Coach

Q. When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event?

  • (A) The first object that was added as listner.
  • (B) The last object that was added as listner
  • (C) There is no way to determine which listener will be invoked first.
  • (D) It is impossible to have more than one listener for a given event.

A

Admin • 833.24K Points
Coach

Q. Suppose that you want to have an object eh handle the TextEvent of
TextArea object t. How should you add eh as the event handler for?

  • (A) t.addTextListener(eh);
  • (B) eh.addTextListner(t);
  • (C) addTextListner(eh.t);
  • (D) addTextListner(t,eh);

A

Admin • 833.24K Points
Coach

Q. Which is true about a method-local inner class?

  • (A) It must be marked final.
  • (B) It can be marked abstract.
  • (C) It can be marked public.
  • (D) It can be marked static.

A

Admin • 833.24K Points
Coach

Q. Which statement is static and synchronized in JDBC API?

  • (A) executeQuery()
  • (B) executeUpdate()
  • (C) getConnection()
  • (D) prepareCall()

A

Admin • 833.24K Points
Coach

Q. Which driver is efficient and always preferable for using JDBC applications?

  • (A) Type – 4
  • (B) Type – 1
  • (C) Type – 3
  • (D) Type – 2

A

Admin • 833.24K Points
Coach

Q. Which one of the following does not extends java.awt.Component

  • (A) CheckBox
  • (B) Canvas
  • (C) CheckbocGroup
  • (D) Label

A

Admin • 833.24K Points
Coach

Q. What is default layout manager for panels and applets?

  • (A) Flowlayout
  • (B) Gridlayout
  • (C) BorderLayout
  • (D) none

A

Admin • 833.24K Points
Coach

Q. Which of the following methods finds the maximum number of connections that a specific driver can obtain?

  • (A) Database.getMaxConnections
  • (B) Connection.getMaxConnection
  • (C) DatabaseMetaData.getMaxConnections
  • (D) ResultSetMetaData.getMaxConnections

A

Admin • 833.24K Points
Coach

Q. What is the disadvantage of Type-4 Native-Protocol Driver?

  • (A) At client side, a separate driver is needed for each database.
  • (B) Type-4 driver is entirely written in Java
  • (C) The driver converts JDBC calls into vendor-specific database protocol
  • (D) It does not support to read MySQL data.