Given the code fragment:
Which code fragment inserted at line 10 print ****?
A.
B.
C.
D.
E.
Given the code fragment:
Which code fragment inserted at line 10 print ****?
A.
B.
C.
D.
E.
E
Answer is A and E.
Answer is A and E. To test: public static void main(String[] args) { int x; /* insert code here */ /* Option A - Ok */ /* x = 3; do { System.out.print("*"); x--; } while (x >= 0); */ /* Option B - It does not enter the loop. */ /* x = 0; do { System.out.print("*"); x++; } while (x >= 3); */ /* Option C - It does not enter the loop. */ /* x = 0; do { System.out.print("*"); ++x; } while (x > 3); */ /* Option D - I only printed two asterisks */ /* x = 3; do { System.out.print("*"); x--; } while (x != 1); */ /* Option E - Ok / /* x=0; do { System.out.print("*"); }while(x++ < 3); */ }
Answer is AE
Only A
The correct answer is the letter E, because it starts to put * from zero, analyze these questions well, the answers are very confusing precisely to take the time wrong on purpose.