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.


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

Computer Science & Information Technology

You might also like to view...

Clicking a button labeled ____ replies to a message.

A. Reply B. Send/Receive C. Fill Inbox D. Check Mail

Computer Science & Information Technology

A path consists of ____.

A. a drive letter B. one or more libraries C. a colon D. one or more folder names

Computer Science & Information Technology

If a file has been edited and a user immediately attempts to close it, what happens?

A) The file automatically closes. B) A warning message is displayed asking the user if he or she wants to save the changes. C) The new, edited file is automatically saved. D) A backup file is automatically saved.

Computer Science & Information Technology

If you want to research Access functions, a good place to start is the Help menu

Indicate whether the statement is true or false

Computer Science & Information Technology