Home
MCQs
Java MCQs
All MCQs
Java MCQs

Java MCQs - All MCQs

History, JVM, JRE and JDK, Variables, Data Types, Operators, Control Statements, Iterative Statements, Object Class, Naming conventions, Constructors

1. What is a class in Java?

A. static reference

B. template or blueprint

C. instance of class

D. None of above

Answer: B

2. What is the correct output of this program ?

A. A greater than B

B. A less than B

C. A greater than B OR A less than B

D. Valid Condition

Answer: D

3. What the naming convention should be for Packages in Java?

A. It should be a lowercase letter such as java, lang

B. If the name contains multiple words, it should be separated by dots (.) such as java.util, java.lang

C. All of above

Answer: C

4. What is the correct output of this program ?

A. Run time Error

B. Compile time error

C. 70 69 68 67 66 65 64 63 62 61

D. 70 69 68 67 66 65 64 63 62

Answer: B

5. If condition is false then ?

A. Block of If condition will be executed

B. Block of If condition will not be executed

C. Block of Else will be executed (If exists)

D. Both B & A

Answer: D

6. An statement that checks the equality only ?

A. If

B. Switch

C. If and Switch

Answer: B

7. What is the default value of double ?

A. 0L

B. 0f

C. 0d

D. 0.0d

Answer: D

8. Which are the object characteristics?

A. State

B. Behavior

C. Identity

D. All of above

Answer: D

9. When Sun Micro-systems released the first public implementation as Java 1.0?

A. 1991

B. 1992

C. 1995

D. 1997

Answer: C

10. Which are the non-primitive data types ?

A. Arrays

B. Classes

C. Interfaces

D. All of Above

Answer: D