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

Q 1 - What is the size of byte variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : A

Explaination

The byte data type is represented by an 8-bit signed two's complement integer.

Minimum value: -128

Maximum value: 127

Q 2 - What is the size of double variable?

A - 8 bit

B - 16 bit

C - 32 bit

D - 64 bit

Answer : D

Explaination

The double data type is represented by double-precision 64-bit IEEE 754 floating point.

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

A - '\u0000'

B - 0

C - null

D - not defined

Answer : A

Explaination

char variable has default value of '\u0000' if defined as an instance/static variable.

Answer : C

Explaination

It is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. Therefore encapsulation is also referred to as data hiding.

Q 6 - Can be constructor be made final?

A - True.

B - False.

Answer : B

Explaination

No, this is not possible.

Answer : A

Explaination

A NullPointerException is thrown when calling the instance method of a null object or modifying/accessing field of a null object.

Answer : B

Explaination

When a task invokes its sleep() method, it returns to the waiting state.

Q 9 - Can try statements be nested?

A - True.

B - False.

Answer : A

Explaination

Yes, try statements be nested.

Answer : B

Explaination

A program is expected to recover if an exception occurs.

java_questions_answers.htm
Advertisements