Java Tutorial

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 List Interface

Java Queue Interface

Java Map Interface

Java Set Interface

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

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 - What is the size of long variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : D

Explaination

The long data type is represented by 64-bit two's complement integer.

Minimum value: -263

Maximum value: 263-1

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

A - 0

B - 0.0

B - null

B - undefined

Answer : A

Explianation

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

Q 5 - A class always has a default constructor.

A - True

B - False

Answer : B

Explaination

It is not mandatory to have a default constructor in a class.

Q 6 - Can be constructor be made private?

A - True.

B - False.

Answer : A

Explaination

Yes, class with private constructor can not instantiated using new keyword.

Answer : A

Explaination

Static binding occurs during Compile time.

Answer : A

Explaination

These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

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.

java_questions_answers.htm
Advertisements