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

61. Which is the right naming convention for Variable in Java?

A. double GrossSalary;

B. double grossSalary;

C. double gross_salary;

D. All of above

Answer: B

62. What will be the output of following program?

A. 0123456789

B. 02468

C. 0246810

D. 123456789

Answer: B

63. Web Applications are known as

A. Distributed applications

B. Server side applications or Web applications

C. Desktop applications or Window-based applications

D. Android applications or Java ME applications

Answer: B

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

65. What is the default value of double ?

A. 0L

B. 0f

C. 0d

D. 0.0d

Answer: D

66. If you do not follow the naming conventions then you will fail to recognize Java identifiers

A. true

B. false

Answer: A

67. What is the correct output of this program ?

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

B. None

C. 1 3 5 7 9

D. Infinite Loop

Answer: C

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

69. What are the different ways to create an object in Java?

A. by new keyword

B. by newInstance() or clone() method

C. by deserialization & factory method

D. All of Above

Answer: D

70. JDK stands for ?

A. Java Development Kit

B. Java Virtual Machine

C. Java Run-time Environment

D. None of Above

Answer: A