?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Loop Control Variables

APCSA-SFUJL2

For which values of first and second are the following two loops equivalent?

 //First Loop
 for (int count = first; count <= second; count++)
  makeMove();

 //Second Loop
 count = first;
 while (count < second)
 {
  makeMove();
  count++;
 }
A

For all values

B

Only if first >= second

C

Only if first > second

D

Only if first = second

E

Only if first<second