IAE Academy

GATE 2025 CS2 Q.39: solution and answer

GATE 2025 · CS2Q.39 · 2 marks · MCQ

For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block.

Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?

  1. (A)

    64 KB and 4 KB

  2. (B)

    128 KB and 16 KB

  3. (C)

    64 KB and 8 KB

  4. (D)

    128 KB and 6 KB

See the question in the paper

Answer and solution

ANSWER

Main memory = 64 KB, Cache memory = 4 KB → Option (A)

Official answer: ASource: Official answer key, GATE 2025 CS2 (IIT Roorkee)

  1. Address structure for a direct-mapped, byte-addressable cache: total address bits = tag bits + index bits + block-offset bits.

  2. Block size = 1 byte ⇒ block-offset bits = .

  3. Total address bits = bits.

  4. Main memory size = .

  5. Number of cache lines (blocks) = .

  6. Cache memory size = (number of lines) × (block size) = (no extra tag/valid-bit storage is counted, per the question's assumption).

  7. Main memory = 64 KB and Cache memory = 4 KB, which is option (A).

KEY IDEA

In a direct-mapped, byte-addressable cache, the memory address splits into Tag + Index + Block-offset bits. Main memory size = bytes; number of cache lines = ; cache size = (number of lines) × (block size).

WATCH OUT FOR

Forgetting that a block-offset field needs bits and wrongly adding an extra offset bit even when block size is 1 byte (offset = 0 bits), or confusing "index bits" with "number of blocks" incorrectly when computing cache size.

From the GATE 2025 CS2 paper. Every question of this paper · Download the full paper · All 22 Memory & cache questions, with notes

More Memory & cache questions