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

91. 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

92. What the naming convention should be for Methods in Java?

A. It should start with lowercase letter.

B. It should be a verb such as show(), count(), describe()

C. If name contains many words then first word's letter start with lowercase only and other words will start with uppercase

D. All of above

Answer: D

93. JRE stands for ?

A. Java Development Kit

B. Java Virtual Machine

C. Java Run-time Environment

D. None of Above

Answer: C

94. A variable, which gets memory at runtime when an object is created is called?

A. static variable

B. local variable

C. instance variable

Answer: C

95. Constructor name and class name can be different in java?

A. Yes

B. No

Answer: B

96. Where to declare class variables ?

A. It declares inside the class and outside of method.

B. It declares inside the class with static prefix and outside of method.

C. It declares inside the method.

Answer: B

97. What is the default value of int ?

A. 0 default value

B. 0i default value

C. 0l default value

D. 0.0f default value

Answer: A

98. What is the correct output of following program?

A. Run time Error

B. Compile time error

C. 55 57 59 61 63 65 67 69

D. 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

Answer: C

99. An object can be initialize in Java by?

A. reference variable

B. method

C. constructor

D. All of above

Answer: D

100. What is the default value of byte ?

A. 0 default value

B. 0b default value

C. 0.0 default value

D. 0.0f default value

Answer: A