Top 250+ Solved Java Programming MCQ Questions Answer

From 31 to 45 of 285

Q. Which method in Thread class is used to check weather a thread is still running?

a. isAlive()

b. Join()

c. isRunning()

d. Alive()

  • a. isAlive()

Q. Which of these class contains the methods print() & println()?

a. System

b. System.out

c. BufferedOutputStream

d. PrintStream

  • d. PrintStream

Q. Consider the following list.list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase, that is, after two iteration of the outer for loop?

a. list = {10, 18, 24, 20, 75, 70, 60, 35}

b. list = {10, 18, 20, 24, 75, 70, 60, 35}

c. list = {10, 18, 24, 75, 70, 20, 60, 35}

d. None of these

  • c. list = {10, 18, 24, 75, 70, 20, 60, 35}

Q. Which method would you most likely use to add an element to an end of a vector?

a. insertElementAt

b. addElement

c. copyInto

d. lastElement

  • b. addElement

Q. In which package is the class Vector located?

a. javio

b. java.lang

c. java.util

d. java.text

  • c. java.util

Q. An abstract method ____.

a. is any method in the abstract class

b. cannot be inherited

c. has no body

d. is found in a subclass and overrides methods in a super-class using the reserved word abstract

  • c. has no body

Q. The classes Reader and Writer are derived from the class _________.

a. Streams

b. Inputs

c. Outputs

d. Object

  • d. Object

Q. The method toString() is a public member of the class _____________.

a. Object

b. String

c. Writer

d. Output

  • a. Object

Q. For the interface WindowListener that contains more than one method, Java provides theclass ____.

a. MouseAdapter

b. WindowAdapter

c. KeyListener

d. KeyAdapter

  • b. WindowAdapter

Q. If a negative value is used for an array index, ____.

a. a NumberFormatException is thrown

b. the program terminates immediately

c. the last index of the array is automatically accessed instead

d. an IndexOutOfBoundsException is thrown

  • d. an IndexOutOfBoundsException is thrown

Q. Which of these packages contains all the classes and methods required for even handlingin Java?

a. javapplet

b. java.awt

c. java.event

d. java.awt.event

  • d. java.awt.event

Q. What is an event in delegation event model used by Java programming language?

a. An event is an object that describes a state change in a source.

b. An event is an object that describes a state change in processing.

c. An event is an object that describes any change by the user and system.

d. An event is a class used for defining object, to create events.

  • a. An event is an object that describes a state change in a source.

Q. Which of these methods are used to register a keyboard event listener?

a. KeyListener()

b. addKistener()

c. addKeyListener()

d. eventKeyboardListener()

  • c. addKeyListener()
Subscribe Now

Get All Updates & News