MCQ Practice Single Best Answer Topic: Java Control Flow

Q Which option, inserted at line 4, produces the output 12?
1. public class Test{
2.       public static void main(String [] args){
3.             int x = 0;
4.             // insert code here
5.             do{ } while(x++ < y);
6.             System.out.println(x);
7.       }
8. }

Question ID
#2153
Subchapter
Java Control Flow
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A int y = x;
  • B int y = 10;
  • C int y = 11;
  • D int y = 12;
Correct Answer: C

Explanation

int y = 11;

Share This Question

Share this MCQ with your friends or study group.