Question
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
Official answer and solution
- Official answer
- 128
- From
- Official GATE 2026 answer key
Solution
Match the binary pattern of cache block index within the 20-bit physical address 0xA2C28 to find the maximum bit position of the cache index + offset fields.
Writing the 20-bit physical address 0xA2C28 from MSB (bit 19) to LSB (bit 0) and the target cache block number in binary:
In a direct-mapped cache with blocks (where since ) and block size bytes, the -bit cache index occupies bits of the physical address and must evaluate to :
- Inspecting the bits of
0xA2C28, bits are10110000(), so the block offset has bits ( bytes per block). - Furthermore, bits , , and are all
0(bit is1). Thus the cache index field can extend from bit up to bit (00010110000), giving index bits ( blocks).
Therefore, the maximum possible cache size is:
128
Stopping at bit 15 (0x2 = 0010) without noticing that bit 16 (the LSB of 0xA = 1010) is also 0.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2026 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 56 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.