GRE Computer Science Practice Book 2011 - Question 06
6. Consider the following function.
int f ()
{
int k, result;
result = 0;
for ( k = 0; k less than 5; k++ )
{
if ( ( k % 3 ) == 1 )
result = result + k;
else
result = result + 1;
}
return result;
}
What value is returned as a result of the call f () ?
(A) 5 (B) 6 (C) 7 (D) 8 (E) 9