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 - Can we have multiple classes in same java file?

A - True

B - False

Answer : A

Explaination

True, a java file can contain one public class and many other non-public classes.

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.

Answer : C

Explaination

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

Answer : C

Explaination

An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

Answer : A

Explaination

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

Answer : A

Explaination

If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

Answer : B

Explaination

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

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 of the following is a thread safe?

A - StringBuilder

B - StringBuffer

C - Both of the above

D - none of the above

Answer : B

Explaination

StringBuffer is thread safe.

java_questions_answers.htm
Advertisements