Java MCQs - All MCQs
History, JVM, JRE and JDK, Variables, Data Types, Operators, Control Statements, Iterative Statements, Object Class, Naming conventions, Constructors
111. What the naming convention should be for Class in Java?
A. It should start with the uppercase letter.
B. It should be a noun such as Student, School, Book
C. Use appropriate words, instead of acronyms.
D. All of above
View Answer
112. Where to declare local 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.
View Answer
113. What is the output of this program?
A. 0 default value
B. Compile time error - Instance variable may not have been initialized
C. Run time error - Instance variable may not have been initialized
D. None of Above
View Answer
114. An object can be initialize in Java by?
A. reference variable
B. method
C. constructor
D. All of above
View Answer
115. What is the correct output of this program ?
A. If condition true
B. Else true
C. Both of above
View Answer
116. Which is the right naming convention for method in Java?
A. void DrawShape()
B. void draw_shape()
C. void drawShape()
D. All of above
View Answer
117. What is the correct output of this program ?
A. 1 2 3 4 5 6 7 8 9 10
B. 0 1 2 3 4 5 6 7 8 9 10
C. 1 2 3 4 5 6 7 8 9 10 11
D. None of above
View Answer
118. When the Java language project initiated?
A. June 1991
B. April 1995
C. Jan 1996
D. Feb 1997
View Answer
119. What is the default value of boolean?
A. true
B. false
C. '1'
D. '0'
View Answer
120. What is the correct output of this program ?
A. 2 4 6 8 10
B. Compile time error
C. Infinite Loop
D. None
View Answer
