Timedora
Free Practice Quiz Question List

Caches Online Quiz Questions

Use this free practice quiz with 20 questions to review Caches, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

Why can adding an SRAM cache between processor registers and DRAM improve the system’s cost/performance balance?

  1. A

    It replaces main memory with SRAM so every program value is stored in the fastest memory.

  2. B

    It keeps frequently accessed data in fast SRAM so many accesses can avoid slower main memory.

  3. C

    It makes registers larger by copying all of main memory into them.

  4. D

    It ensures that every memory access takes the same number of cycles.

02
True or false
1 point

True or false: Every cache miss is the first access to that memory line.

  1. A

    True

  2. B

    False

03
Choose all
1 point

Select all statements that correctly describe temporal or spatial locality.

  1. A

    Repeatedly accessing the same memory location soon after its previous access demonstrates temporal locality.

  2. B

    Reading consecutive array elements demonstrates spatial locality.

  3. C

    Reading one value makes an unrelated, far-away address an example of spatial locality.

  4. D

    Temporal locality means that nearby addresses are likely to be accessed together.

04
Written response
1 point

A cache uses 16-byte blocks. Loading 0x120 misses and fills its block, which covers addresses 0x120 through 0x12F. The next access loads 0x121, with no intervening accesses. Is the second access a hit or a miss?

05
Fill in the blank
1 point

For a direct-mapped cache lookup to be a hit, the selected entry’s valid bit must be , and its stored tag must the requested address’s tag.

06
Choose one
1 point

A direct-mapped cache designer is choosing between the stripe and chunk mappings described in the material. Which reason supports choosing stripe mapping?

  1. A

    Stripe mapping distributes neighboring addresses across different indices, helping the cache serve spatially local accesses.

  2. B

    Chunk mapping distributes neighboring addresses across different indices, helping the cache serve spatially local accesses.

  3. C

    Stripe mapping sends every address to the same index, reducing conflicts from nearby data.

  4. D

    Chunk mapping guarantees that every memory address has a unique cache index.

07
Fill in the blank
1 point

A direct-mapped cache has 256 entries, 16-byte blocks, and 32-bit addresses. Fill in the number of bits in each field: block offset = , index = , and tag = .

08
Written response
1 point

A cache has a hit time of 1 ns and a miss penalty of 50 ns. If 95% of accesses hit, calculate the average memory access time using tavg=thit+rmiss×tmisst_{avg}=t_{hit}+r_{miss}\times t_{miss}. Enter the numerical value in nanoseconds.

09
True or false
1 point

True or false: In a write-back cache, every store hit immediately sends the updated data to main memory.

  1. A

    True

  2. B

    False

10
Choose one
1 point

A cache has 512 total entries and is 2-way set-associative. How many sets does it contain?

  1. A

    128

  2. B

    256

  3. C

    510

  4. D

    1,024

11
Choose all
1 point

Select all statements that correctly distinguish the three classic categories of cache misses.

  1. A

    A cold miss occurs on the first access to a given cache line.

  2. B

    A conflict miss can occur when lines compete for the same set and one evicts another needed later.

  3. C

    A capacity miss can persist in a fully associative cache when the working set exceeds the cache’s capacity.

  4. D

    Every miss after an eviction is necessarily a capacity miss.

12
Choose one
1 point

Why is a fully associative cache generally practical only when it is small?

  1. A

    It avoids searching entries because each memory block has a predetermined index.

  2. B

    It is costly only because it requires a replacement policy when the cache is full.

  3. C

    It must search all entries on every access, making the hardware large, hot, and slow as the cache grows.

  4. D

    It needs fewer tag bits than a direct-mapped cache with the same block size.

13
Choose one
1 point

When evicting an entry from a write-back cache, what should happen if the entry is dirty?

  1. A

    Write the entry back to main memory whether it is clean or dirty.

  2. B

    Write the entry back to main memory if it is dirty; if it is clean, no write-back is needed.

  3. C

    Discard the entry without writing it back, because the dirty bit only affects hits.

  4. D

    Set the valid bit to zero and leave main memory unchanged in both cases.

14
Open ended
1 point

A designer increases the block size of a direct-mapped cache while keeping total cache capacity fixed. Explain how this change can affect cold misses, conflict misses, tag overhead, and miss penalty, and why its overall effect on performance is not always an improvement.

15
Choose one
1 point

A loop repeatedly updates the same variable, total, on each iteration. Which form of locality best describes these accesses to total?

  1. A

    Spatial locality, because the accesses are to nearby memory addresses.

  2. B

    Temporal locality, because the same memory address is accessed repeatedly.

  3. C

    Neither form of locality, because the variable is updated.

  4. D

    Both forms, because every loop access is to a different address.

16
Choose one
1 point

A direct-mapped cache uses 32-bit byte addresses, has 256 entries, and stores 16-byte blocks. Which address-field breakdown is correct, listed as offset, index, and tag?

  1. A

    Offset: 8 bits; index: 4 bits; tag: 20 bits.

  2. B

    Offset: 4 bits; index: 20 bits; tag: 8 bits.

  3. C

    Offset: 4 bits; index: 8 bits; tag: 20 bits.

  4. D

    Offset: 8 bits; index: 8 bits; tag: 16 bits.

17
Choose one
1 point

A cache fetches an entire 16-byte block on a load miss. Starting with an empty cache, a program loads one byte and then immediately loads the next byte in memory. What happens, assuming both bytes belong to the same block?

  1. A

    The first access misses; the second hits because it is in the block just fetched.

  2. B

    Both accesses miss because each address is a distinct byte.

  3. C

    The first access hits; the second misses because it has a different offset.

  4. D

    Both accesses hit because they are adjacent in memory.

18
Written response
1 point

A set-associative cache has 512 total entries and 4 ways per set. How many sets does it have? Enter the number of sets.

19
True or false
1 point

For a fixed cache capacity, a fully associative cache can avoid conflict misses, although it can still experience capacity misses.

  1. A

    True

  2. B

    False

20
Written response
1 point

A fully associative cache has three entries and uses least-recently used (LRU) replacement. Starting with an empty cache, it accesses blocks A, B, C, A, and then D. Which block is evicted when D is loaded?