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

41. What is the right output of this program ?

A. 3,12

B. 0,12

C. 3,0

D. 3,3

Answer: A

42. What is the correct output of this program ?

A. 10987654321

B. 987654321

C. 123456789

D. 12345678910

Answer: A

43. What the naming convention should be for Interfaces in Java?

A. It should start with the uppercase letter.

B. It should be an adjective such as Intelligent, Acceptable

C. Use appropriate words, instead of acronyms.

D. All of above

Answer: D

44. A program which shows an example of

A. initialization by reference variable

B. initialization by method

C. initialization by constructor

D. None of above

Answer: B

45. What is an object in Java?

A. static reference

B. template or blueprint

C. instance of class

D. None of above

Answer: C

46. What is the correct output of this program ?

A. Run time Error

B. 1 2 3 4 5 6 7 8 9 10

C. Infinite Loop

D. 0 1 2 3 4 5 6 7 8 9 10

Answer: B

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

Answer: D

48. What the naming convention should be for Variables in Java?

A. It should start with a lowercase letter such as id, name

B. It should not start with the special characters, And Avoid using one-character variables such as x, y, z.

C. If name have multiple names then start it with the lowercase letter followed by an uppercase letter such as firstName, lastName.

D. All of Above

Answer: D

49. What is a Java development kit (JDK) ?

A. It is a set of libraries with a Java runtime environment.

B. It is a just development tool.

C. It is a development tool with a Java runtime environment.

D. It is a just runtime environment.

Answer: C

50. What is the right output of this program ?

A. 6765

B. 5654

C. 5775

D. 5765

Answer: C