Question

Consider a system with a processor and a 4 KB direct mapped cache with block size of 16 bytes. The system has a 16 MB physical memory. Four words P, Q, R, and S are accessed by the processor in the same order 10 times. That is, there are a total of 40 memory references in the sequence P, Q, R, S, P, Q, R, S, ...

Assume that the cache memory is initially empty. The physical addresses of the words are given below (1 word = 1 byte).

P: 0x845B32, Q: 0x845B26, R: 0x845B36, S: 0x846B32

Which of the following statements is/are true?

Note: 1K=2101\text{K}=2^{10} and 1M=2201\text{M}=2^{20}

Choose every correct option
Official answer and solution
Official answer
A and B
From
Official GATE 2026 answer key

Solution

Extract the 12-bit Tag, 8-bit Cache Index, and 4-bit Block Offset from each 24-bit hex address.

With a 4 KB=2124\text{ KB} = 2^{12} byte direct-mapped cache and 16=2416 = 2^4 byte block size:

  • Block offset: lowest 44 bits (last hex digit).
  • Cache index: next log⁡2(212/24)=8\log_2(2^{12}/2^4) = 8 bits (the two hex digits before the last hex digit).
  • Tag: upper 24−12=1224 - 12 = 12 bits (first three hex digits).

Decoding the four addresses:

  • P (0x845B32): Tag =845= \texttt{845}, Index =B3= \texttt{B3}, Offset =2= \texttt{2}
  • Q (0x845B26): Tag =845= \texttt{845}, Index =B2= \texttt{B2}, Offset =6= \texttt{6}
  • R (0x845B36): Tag =845= \texttt{845}, Index =B3= \texttt{B3}, Offset =6= \texttt{6}
  • S (0x846B32): Tag =846= \texttt{846}, Index =B3= \texttt{B3}, Offset =2= \texttt{2}

Tracing the access loop P, Q, R, S:

  • P maps to Index B3 (Tag 845): on iteration 1 it is a cold miss; on iterations 2..10 it is a conflict miss because S (Index B3, Tag 846) replaced block B3 at the end of the previous iteration. Thus every access to P is a miss (A is true).
  • Q maps alone to Index B2 (Tag 845): misses on iteration 1, and hits on iterations 2..10 (C is false).
  • R maps to the exact same memory block as P (Tag 845, Index B3), which was just loaded by P in the same iteration. Thus every access to R is a cache hit (B is true).
  • S maps to Index B3 (Tag 846), which is overwritten by P in every iteration, so every access to S is a miss (D is false).
Final answer

Options (A), (B)

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
52 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.