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

31. What is the correct output of this program ?

A. It will print 10 times "Hello Loop"

B. Run time error

C. It will print 1 time "Hello Loop"

D. None of above

Answer: C

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

Answer: A

33. What is the default value of double ?

A. 0L

B. 0f

C. 0d

D. 0.0d

Answer: D

34. Which is the right naming convention for package in Java?

A. package com.sindhi.tutorials;

B. package comSindhiTutorials;

C. package ComSindhiTutorials;

D. All of above

Answer: A

35. JRE stands for ?

A. Java Development Kit

B. Java Virtual Machine

C. Java Run-time Environment

D. None of Above

Answer: C

36. What is the default size of long ?

A. 1 byte

B. 2 bytes

C. 4 bytes

D. 8 bytes

Answer: D

37. Java ME stands for ?

A. Java Enterprise Edition

B. Java Standard Edition

C. Java Micro Edition

D. None of Above

Answer: C

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

39. Can a private constructor be declared in Java class?

A. Yes

B. No

Answer: A

40. What the naming convention should be for Constants in Java?

A. It should be in uppercase letters such as DAY, MONTH

B. If the name contains multiple words, it should be separated by an underscore(_) such as FINAL_DATE.

C. It may contain digits but not as the first letter

D. All of above

Answer: D