Solved

For the Questions Below, Assume an Int Array, Candy, Stores

Question 33

Multiple Choice

For the questions below, assume an int array, candy, stores the number of candy bars sold by a group of children where candy[j] is the number of candy bars sold by child j. Assume there are 12 children in all.
-Which of the following code could be used to compute the total number of bars sold by the children?


A) for (int j=0; j<12; j++) sum += candy[j];
B) for (int j=0; j<12; j++) candy[j] = sum;
C) for (int j=0; j<12; j++) sum = candy[j];
D) for (int j=0; j<12; j++) sum += [j];
E) for (int j=0; j<12; j++) [j] += sum;

Correct Answer:

verifed

Verified

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

Related Questions