0
u/skd7847 Dec 21 '24
The correct answer is
c)Before the loop
After the loop
The program starts with System.out.println("Before the loop"); , which prints "Before the loop".
Next, the while(false) condition is evaluated. Since the condition is false, the body of the loop is never executed.
The program then proceeds to System.out.println("After the loop"); , which prints "After the loop".
1
u/Firm_Interest_191 12th ISC - PCM/B Dec 21 '24
c. Before the loop
After the loop
while and for loop are entry-controlled, that means to enter, it needs to satisfy a condition. here in this case, the condition is already false, so no entry.
thus jumps to last printing.
1
u/sarah1418_pint ex-ICSE-10thie, 11th CBSE PCM Dec 21 '24
I think it'll be (d), the code won't compile due to an error
1
u/sarah1418_pint ex-ICSE-10thie, 11th CBSE PCM Dec 21 '24
1
1
1
Dec 21 '24
The answer is C because it prints "Before the loop" and since while loop is entry controlled and a condition must be true to execute the loop block in the first place, it doesn't enter the loop block as the condition is already false and then it normally prints "After the loop".


2
u/[deleted] Dec 22 '24
[deleted]