Important Java Mcq 1

How many times will the following code print “Welcome to Java”?

int count = 0;
while (count < 10) {
    System.out.println("Welcome to Java");
    count++;

}

a. 13

b. 12

c. 11

d. 10

Answer:

d. 10

Explanation:

The value of count is getting incremented by 1 every time starting from 0 till it reaches 10 which would lead to 10 print statements.

Related MCQs

Which statement is true about Java?

a) Java is a sequence-dependent programming language b) Java is a code dependent programming language c) Java is a platform-dependent programming language d) Java is

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?