IAE Academy

GATE 2026 CS2 Q.56: solution and answer

GATE 2026 · CS2Q.56 · 2 marks · NAT

Consider a system with 1 MB physical memory and a word length of 1 byte. The system uses a direct mapped cache, with block numbers starting from 0. The word with physical address 0xA2C28 is mapped to the cache block number . The maximum possible size of the cache (in KB) for this configuration is ____________. (answer in integer)

Note: and .

See the question in the paper

Answer and solution

ANSWER

The maximum possible size of the cache is .

Official answer: 128Source: Official answer key, GATE 2026 CS2 (IIT Guwahati)

  1. Physical memory bytes and the word length is 1 byte, so a physical address is 20 bits wide (bit19 to bit0), with no separate word-offset-within-word bits needed.

  2. Write in 20-bit binary: (bit19bit0). (Check: this reproduces .)

  3. A direct-mapped address splits as , with block size bytes, number of blocks , and cache size bytes.

  4. (8 bits). Scanning every possible 8-bit window of the 20-bit address (all 13 offsets ) for the value shows exactly one match: bits. So the block-offset width must be .

  5. With fixed, grow the block-number width upward from 8 one bit at a time; the field still reads 176 only while each newly absorbed higher bit is 0. bit14 (, field still ), bit15 (, still ), bit16 (, still ).

  6. bit17, so absorbing it changes the field's value away from 176 (it becomes ). Hence is the largest block-number width consistent with the given mapping, i.e. at most cache blocks.

  7. Maximum cache size bytes . (Tag width bits, nonzero, so the split is self-consistent.)

KEY IDEA

In a direct-mapped cache, the address splits into Tag | Block number ( bits) | Block offset ( bits). Given only the numeric value of the block number (not or individually), find every bit-offset at which an 8-bit window of the physical address equals that block number in binary; here only works. Then, holding fixed, the block-number field can be widened ( increased) for free as long as every newly included higher-order bit is 0, since a leading 0 does not change the field's decimal value — this is what lets the cache be "maximum possible" size rather than a single fixed size.

WATCH OUT FOR

Assuming the number of bits in the binary form of the block number (here , 8 bits) directly gives , and stopping there — i.e. computing cache size as instead of recognizing that higher-order zero bits can be folded into a wider block-number field without changing its decimal value, which is what the word "maximum possible" in the question is asking you to exploit.

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

More Memory & cache questions