Which of the following statements are true?

```
Segment 1 Segment 2
int i = 0;
for (int i = 0; i <= 20; i++) {
while (i < 20) { System.out.println(i);
i++; }
System.out.println(i);
}
```

a. The output from these segments is not the same.
b. The scope of the control variable i is different for the two segments.
c. Both (a) and (b) are true.
d. Neither (a) nor (b) is true.


c. Both (a) and (b) are true.

Computer Science & Information Technology

You might also like to view...

Create an SVG document that simulates a clock with a pendulum (i.e., hour hand, minute hand, pendulum). An example image is shown in Fig. 20.28.

Computer Science & Information Technology

An Intranet is a network of websites viewable by anyone with Internet access

Indicate whether the statement is true or false

Computer Science & Information Technology

Apply the rule of IF Statement

Write a multiple-line IF statement that outputs the message "Yes" when the variable x equals 1, and the message "No" when the variable x doesn't equal I.

Computer Science & Information Technology

When inserting an item into an array, assume that ____.

A. 0 <= target index  = logical size B. 0 < target index  <= logical size C. 0 <= target index  < logical size D. 0 <= target index  <= logical size

Computer Science & Information Technology