Solved

The for Loop Header Can Contain Multiple Variables of the Same

Question 7

Multiple Choice

The for loop header can contain multiple variables of the same type and multiple update expressions, separated by commas:

for (int i = 0; j = 3; i <= 5; i++, j--)
Which loop below correctly implements the same loop using a single counter in the loop control?


A) int i=0;
for (int j=3 ; j<=5 ; j++ )
{
i++;
}
B) Int i=3;
for (int j=0 ; j<=5 ; j++ )
{
i++;
}
C) int j=3;
for (int i=0 ; i<=5 ; j--)
{
i++;
}
D) Int j=3;
for (int i=0 ; i<=5 ; i++)
{
. . .
j--;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions