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

Answer : C

Explaination

Correct syntax is public static void main(String[] args).

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 short variable?

A - 0.0

B - 0

B - null

B - undefined

Answer : B

Explaination

Short variable has default value of 0 if defined as an instance/static variable.

Q 4 - What is the default value of Object variable?

A - undefined

B - 0

C - null

D - not defined

Answer : C

Explaination

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

Answer : C

Explaination

It refers to the ability to make a class abstract in OOP. It helps to reduce the complexity and also improves the maintainability of the system.

Answer : A

Explaination

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

Answer : D

Explaination

Final classes are created so the methods implemented by that class cannot be overridden. It can't be inherited. These classes are declared final.

Answer : A

Explaination

Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.

Q 9 - Can a top level class be private or protected?

A - True.

B - False.

Answer : B

Explaination

No, a top level class can not be private or protected. It can have either "public" or no modifier.

Q 10 - This is the parent of Error and Exception classes.

A - Throwable

B - Catchable

C - MainError

D - MainException

Answer : A

Explaination

Throwable is the parent of both Error and Exception class.

java_questions_answers.htm
Advertisements