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
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?