Question 1 of 5
Evaluate each MOD expression.
(a) 20 MOD 6 (b) 9 MOD 9 (c) Explain in one sentence what MOD returns.
Responses receive AI feedback against a rubric after submission. Scores are practice estimates.
Evaluate each MOD expression.
(a) 20 MOD 6 (b) 9 MOD 9 (c) Explain in one sentence what MOD returns.
Consider the expression 6 + 4 * 2 - 5.
(a) Which operation happens first under standard order of operations? (b) Evaluate the expression step by step. (c) What value would you get if you incorrectly added 6 + 4 before multiplying?
List values holds 2, 4, 6, 8, 10 at indexes 1 through 5.
idx ← (14 MOD 5) + 1
DISPLAY (values[idx])
(a) Compute 14 MOD 5. (b) Compute idx. (c) State what is displayed.
A program classifies seat numbers with seat MOD 4.
| seat | seat MOD 4 |
|---|---|
| 7 | |
| 8 | |
| 9 |
(a) Fill the three MOD results. (b) Which seat number in the table is divisible by 4? Justify. (c) Write a Boolean expression that is true when seat is divisible by 4.
Trace:
x ← 3
y ← 4
z ← x * y + x
DISPLAY (z)
DISPLAY (z MOD 5)
(a) What is z? (b) What does the second DISPLAY show? (c) If z were 5 instead, would z MOD 5 equal z? Explain with the numeric result.