Indiana University Bloomington Evaluation Services and Testing
QuizSite  Students
Quizzes · Tests · Evaluations · Surveys
 Activity: Practice_Five Student: dgerman (Adrian German) Instructor: dgerman Course: J201 Section: 4285
Question 1.
What is the output produced by the following code when embedded in a complete program?
```int x = 14;
while (x < 15)
x = x + 1;
System.out.print(x); ```

Note that the program may or may not be indented correctly so think about it carefully.

Question 2.
What is the output produced by the following code when embedded in a complete program?
```int x = 14;
while (x < 15)
x = x + 1;
System.out.print(x); ```

Note that the program may or may not be indented correctly so think about it carefully.

Question 3.
What is the output produced by the following code when embedded in a complete program?
```int x = 14;
while (x <= 15) {
x = x + 1;
System.out.print(x); } ```

Note that the program may or may not be indented correctly so think about it carefully.

Question 4.
What is the output produced by the following code when embedded in a complete program?
```int i;
for (i = 0; i < 3; i = i + 1)
System.out.print(1);
System.out.print(0); ```

Note that the program may or may not be indented correctly so think about it carefully.

Question 5.
What is the output produced by the following code when embedded in a complete program?
```int i;
for (i = 0; i < 3; i = i + 1) {
System.out.print(1);
System.out.print(0); } ```

Note that curly braces have been added and that the program may or may not be indented correctly so think about it carefully.

Question 6.
What is the output produced by the following code when embedded in a complete program?
```int x = 10, y = 3;
while (x > 0 && y > 0)
x = x - y;
System.out.print(x);```

Note that the program may or may not be indented correctly so think about it carefully.

Question 7.
What is the output produced by the following code when embedded in a complete program?
```int x = 10, y = 3;
while (x > 0 && y > 0) {
x = x - y;
} System.out.print(x);```

Note that the program is the one from question 1 with an extra pair of curly brackets added. It may or may not be indented correctly so think about it carefully.

Question 8.
What is the output produced by the following code when embedded in a complete program?
```int x = 10, y = 3;
while (x >= 0 && y > 0) {
x = x - y;
System.out.print(x);
}  ```

Note that the program is the one from question 1 with an extra pair of curly brackets added. It may or may not be indented correctly so think about it carefully.

Question 9.
What is the output produced by the following code when embedded in a complete program?
```int x = 10;
while (x > 0)
x = x - 3;
System.out.print(x);
```

Question 10.
What is the output produced by the following code when embedded in a complete program?
```int x = 10;
while (x > 0)
x = x - 3;
System.out.print(x);
```

Question 11.
What is the output produced by the following code when embedded in a complete program?
```int x = 10;
while (x > 0) {
x = x - 3;
}
System.out.print(x);
```

Question 12.
What is the output produced by the following code when embedded in a complete program?
```int x = 10;
while (x > 0) {
x = x - 3;
System.out.print(x);
}
```

Question 13.
What is the output produced by the following code when embedded in a complete program?
```int x = 10;
while (x < 0) {
x = x - 3;
}
System.out.print(x);
```