Q.– Given the code fragment:-
8. public static void main(String[ ] args) {
9. int x;
10. /* insert code here */
11. }
Which code fragment at line 10 prints Welcome 100 ?
A) x = 100;
do {
++x;
System.out.println("Welcome " + x);
} while(x < 100);
B) x = 100;
while( x <= 100) {
x++;
System.out.println("Welcome " + x);
}
C) for( x=0 ; x < 100 ; x++){
System.out.println("Welcome " + x);
}
D) for( x=100 ; x <= 100 ; x++) {
System.out.println("Welcome " + x);
}
⧪ please give your answer in a comment section.
8. public static void main(String[ ] args) {
9. int x;
10. /* insert code here */
11. }
Which code fragment at line 10 prints Welcome 100 ?
A) x = 100;
do {
++x;
System.out.println("Welcome " + x);
} while(x < 100);
B) x = 100;
while( x <= 100) {
x++;
System.out.println("Welcome " + x);
}
C) for( x=0 ; x < 100 ; x++){
System.out.println("Welcome " + x);
}
D) for( x=100 ; x <= 100 ; x++) {
System.out.println("Welcome " + x);
}
⧪ please give your answer in a comment section.
5 Comments
D
ReplyDeleteD
ReplyDeleteD
ReplyDeleteD
ReplyDeleteD
ReplyDelete