← Quiz: Memory Hierarchy and Cache: all 10 questions
Quiz: Memory Hierarchy and Cache · Question 10 of 10
What does this print? (code)
What does this print?
lines, block = 8, 16
for a in (0, 128, 40):
blk = a // block
print(blk % lines, end=" ")
print()
- A.0 8 2
- B.0 0 2
- C.0 1 2
- D.0 0 5
Answer & explanation
Correct answer: 0 0 2
Block numbers are 0, 8 and 2; with 8 lines, the line is block mod 8: 0, 0 and 2. Addresses 0 and 128 conflict.
Can you get the rest right without peeking?
Take the timed Quiz: Memory Hierarchy and Cache quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →