Top 250+ Solved Java Programming MCQ Questions Answer

From 46 to 60 of 285

Q. Which of these methods are used to register a mouse motion listener?

a. addMouse()

b. addMouseListener()

c. addMouseMotionListner()

d. eventMouseMotionListener()

  • c. addMouseMotionListner()

Q. What is a listener in context to event handling?

a. A listener is a variable that is notified when an event occurs.

b. A listener is a object that is notified when an event occurs.

c. A listener is a method that is notified when an event occurs.

d. None of the mentioned

  • b. A listener is a object that is notified when an event occurs.

Q. Which command disassembles a class file

a. javaamd

b. javacmd

c. java

d. javap

  • d. javap

Q. JDBC stands for:

a. Java Database Connectivity

b. Java Database Components

c. Java Database Control

d. None of the above is correct.

  • a. Java Database Connectivity

Q. Which of the following statements is false as far as different type of statements is concern in JDBC?

a. Regular Statement

b. Prepared Statement

c. Callable Statement

d. Interim Statement

  • d. Interim Statement

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

a. executeQuery()

b. executeUpdate()

c. getConnection()

d. prepareCall()

  • c. getConnection()

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. Type – 4

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

a. CheckBox

b. Canvas

c. CheckbocGroup

d. Label

  • c. CheckbocGroup

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

a. Flowlayout

b. Gridlayout

c. BorderLayout

d. none

  • a. Flowlayout

Q. java.awt.Component class method getLocation() returns Point (containg x and y cordinate).What does this x and y specify

a. Specify the postion of components lower-left component in the coordinate space of the component's parent.

b. Specify the postion of components upper-left component in the coordinate space of the component's parent.

c. Specify the postion of components upper-left component in the coordinate space of the screen.

d. none

  • b. Specify the postion of components upper-left component in the coordinate space of the component's parent.

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

  • c. DatabaseMetaData.getMaxConnections

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.

  • a. At client side, a separate driver is needed for each database.

Q. What is the preferred way to handle an object's events in Java 2?

a. Override the object's handleEvent( ) method.

b. Add one or more event listeners to handle the events

c. Have the object override its process Event ( ) methods.

d. Have the object override its dispatch Event ( ) methods.

  • b. Add one or more event listeners to handle the events

Q. Which component method is used to access a component's immediate container?

a. getVisible()

b. getImmediate()

c. getParent()

d. getContainer()

  • c. getParent()

Q. Which of the following creates a List with 5 visible items and multiple selections enabled?

a. new List(5, true)

b. new List(true, 5)

c. new List(5, false)

d. new List(false, 5)

  • a. new List(5, true)
Subscribe Now

Get All Updates & News