Core Java - Java (MCQ) questions and answers

1)   Unchecked exceptions are checked at compile-time rather they are checked at runtime.
- Published on 19 Oct 15

a. True
b. False
Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


2)   Which method returns the interrupted flag after that it sets the flag to false if it is true?
- Published on 19 Oct 15

a. isInterrupted()
b. static interrupted()
c. non static interrupted()
d. Both A & C
Answer  Explanation 

ANSWER: static interrupted()

Explanation:
No explanation is available for this question!


3)   The PipedInputStream and PipedOutputStream classes can be used to read and write data simultaneously.
- Published on 19 Oct 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


4)   From the following statements which is a disadvantage of an java array?
- Published on 19 Oct 15

a. An array can hold primitive types data
b. An array has its size that is known as array length
c. An array knows only its type that it contains. Array type is checked at the compile-time
d. An array holds only one type of data
Answer  Explanation 

ANSWER: An array holds only one type of data

Explanation:
No explanation is available for this question!


5)   The following Syntax is used for?

class Subclass-name extends Superclass-name
{
//methods and fields
}

- Published on 19 Oct 15

a. Polymorphism
b. Encapsulation
c. Inheritance
d. None of the above
Answer  Explanation 

ANSWER: Inheritance

Explanation:
No explanation is available for this question!


6)   ResultSetMetaData interface is useful because it provides methods to get metadata from the ResultSet object.

- Published on 22 Jul 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


7)   Which constructor creates an empty string buffer with the specified capacity as length.
- Published on 22 Jul 15

a. StringBuffer()
b. StringBuffer(String str)
c. StringBuffer(int capacity)
d. None of the above
Answer  Explanation 

ANSWER: StringBuffer(int capacity)

Explanation:
No explanation is available for this question!


8)   How many reserved keywords are currently defined in the Java language?
- Published on 22 Jul 15

a. 48
b. 49
c. 50
d. 47
Answer  Explanation 

ANSWER: 49

Explanation:
No explanation is available for this question!


9)   Which mechanism is used when a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed?
- Published on 22 Jul 15

a. Inter-thread communication
b. Initial-thread communication
c. Mutual Exclusive
d. None of the above
Answer  Explanation 

ANSWER: Inter-thread communication

Explanation:
No explanation is available for this question!


10)   Which method is used to change the name of a thread?
- Published on 22 Jul 15

a. public String getName()
b. public void setName(String name)
c. public void getName()
d. public String setName(String name)
Answer  Explanation 

ANSWER: public void setName(String name)

Explanation:
No explanation is available for this question!


1 2 3 4 5 6 7 8 9 10 ...