AP Computer Science A Quiz
20 questions · no time limit
0:00
DATA COLLECTIONS
Question 1 of 20
No time limit
Current
Answered
Flagged
Not seen
A store tracks weekly sales in an int[] and uses totals for restocking decisions. Consider: A farmer's market vendor records daily smoothie sales in an int[] for a 7-day festival to decide how much fruit to bring the next morning. The vendor wants to quickly compute the total sales for the week and the average per day, using a simple loop over the array. Since the data set size is fixed, the array avoids resizing overhead. int[] dailySales = {5, 7, 6, 9, 8, 10, 4}; int total = 0; for (int i = 0; i < dailySales.length; i++) { total = dailySales[i]; // update total } System.out.println(total); Refer to the problem scenario in the passage, identify the error in the following code snippet and suggest a fix.
YOUR PROGRESS
20
QUESTIONS
Ready when you are
Answer in any order. Your progress shows here as you go.
QUESTIONS
KEYBOARD
Pick an answer ABCD
Next question ↵→
Previous ←
Flag for review F