Java Operators

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java Interfaces

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Class References

Java Useful Resources

Java Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to Core Java. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - What of the following is the default value of a local variable?

A - null

B - 0

C - Depends upon the type of variable

D - Not assigned

Answer : D

Explaination

Local variables are not assigned any value by default.

Q 2 - Can we have two public classes in one java file?

A - True

B - False

Answer : B

Explaination

No, a java file can contain only one public class.

Q 3 - What is the default value of String variable?

A - ""

B - ''

C - null

D - not defined

Answer : C

Explaination

String variable has default value of null if defined as an instance/static variable.

Answer : C

Explaination

By default, variables, methods and constructors can be accessed by any class lying in the same package.

Answer : A

Explaination

It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.

Answer : A

Explaination

JIT, Just In-Time Compiler, improves the runtime performance of computer programs based on bytecode.

Answer : A

Explaination

Static binding occurs during Compile time.

Answer : D

Explaination

A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

Answer : A

Explaination

The garbage collector invokes an object's finalize() method when it detects that the object has become unreachable.

Answer : B

Explaination

A program is expected to recover if an exception occurs.

java_questions_answers.htm
Advertisements