Consider the following two Java code segments:

```
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);
}
```

Which of the following statements are true?
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.


d. Neither (a) nor (b) is true.

Computer Science & Information Technology

You might also like to view...

Data markers are listed in the legend of a chart

Indicate whether the statement is true or false

Computer Science & Information Technology

When you add a second animation to an object, a second animation sequence icon appears next to the object. When the object is selected, _____ is selected in the Animation gallery.

A. Two B. Many C. Multiple D. Group

Computer Science & Information Technology

In a MenuStrip, placing what character in front of a unique letter allows the user to press Alt and then the given letter to activate the menu choice as an alternative to clicking it with the mouse?

A. % B. $ C. & D. >

Computer Science & Information Technology

Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____.

A. 1 B. 2 C. 3 D. 4

Computer Science & Information Technology