Question 1 of 5
Use the lap table.
| Runner | Lap1 | Lap2 | Lap3 |
|---|---|---|---|
| Jia | 50 | 48 | 49 |
| Ken | 47 | 47 | 46 |
| Liv | 52 | 51 | 50 |
| Mo | 49 | 48 | 48 |
(a) Compute each runner's Total = Lap1+Lap2+Lap3. (b) Which runner has the smallest Total? (c) If a filter keeps Total < 150, who remains?
Responses receive AI feedback against a rubric after submission. Scores are practice estimates.
Use the lap table.
| Runner | Lap1 | Lap2 | Lap3 |
|---|---|---|---|
| Jia | 50 | 48 | 49 |
| Ken | 47 | 47 | 46 |
| Liv | 52 | 51 | 50 |
| Mo | 49 | 48 | 48 |
(a) Compute each runner's Total = Lap1+Lap2+Lap3. (b) Which runner has the smallest Total? (c) If a filter keeps Total < 150, who remains?
readings ← [11, 9, 14, 9, 12]
PROCEDURE countEqual(list, t)
{
c ← 0
i ← 1
REPEAT LENGTH(list) TIMES
{
IF list[i] = t
{
c ← c + 1
}
i ← i + 1
}
RETURN c
}
(a) What does countEqual(readings, 9) return? (b) Write or describe a companion procedure idea that returns the average of readings. (c) Compute that average.
Cafe orders:
| Drink | Size | Price |
|---|---|---|
| Tea | S | 2 |
| Tea | L | 3 |
| Coffee | S | 3 |
| Coffee | L | 4 |
| Cocoa | L | 4 |
(a) Write CSP-style pseudocode that displays Price for every row where Drink = "Coffee". (b) List the values displayed. (c) Describe how to change the program to display the average Price of Large (Size = L) drinks, and give that average.
A teacher stores homework minutes:
| Student | Minutes |
|---|---|
| Nia | 25 |
| Owen | 40 |
| Pia | 25 |
| Quinn | 55 |
| Rio | 40 |
goal ← 40
i ← 1
foundName ← "none"
REPEAT UNTIL i > 5 OR foundName ≠ "none"
{
IF table[i].Minutes = goal
{
foundName ← table[i].Student
}
i ← i + 1
}
DISPLAY(foundName)
(a) What does the program display? (b) Explain why Pia is not displayed. (c) If goal ← 25, what would be displayed and why?
Warehouse stock:
| SKU | OnHand |
|---|---|
| A1 | 0 |
| B2 | 8 |
| C3 | 0 |
| D4 | 5 |
(a) Which SKUs remain if a program filters OnHand > 0? (b) Compute the average OnHand of the remaining SKUs. (c) Explain one decision a manager could make using that filtered list.