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

A - 8 bit

B - 16 bit

C - 32 bit

D - not precisely defined

Answer : B

Explaination

The boolean data type can take either true or false, but its "size" isn't precisely defined.

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

A - 0.0d

B - 0.0f

C - 0

D - not defined

Answer : B

Explaination

float variable has default value of 0.0f if defined as an instance/static variable.

Answer : B

Explaination

An immutable object can't be changed once it is created. String objects are immutable.

Q 6 - Can be constructor be made final?

A - True.

B - False.

Answer : B

Explaination

No, this is not possible.

Answer : C

Explaination

Holding the reference of the other class within some other class is known as composition. It represents a HAS-A relationship. For example, a Student has a Pen. Here Student class has Pen as its instance variable.

Answer : B

Explaination

A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization.

Q 9 - Deletion is faster in LinkedList than ArrayList.

A - True.

B - False.

Answer : A

Explaination

Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.

Q 10 - which operator is considered to be with highest precedence?

A - () , []

B - =

C - ?:

D - %

Answer : A

Explaination

Postfix operators i.e () [] . is at the highest precedence.

java_questions_answers.htm
Advertisements