GATE Computer ScienceHardGATE CS (PYQ pattern)

A 16 × 16 matrix of 4-byte ints is stored in row-major order from address 0. It is traversed column by column on a direct-mapped 2 KB cache with 32-byte blocks. How many misses occur?

  1. A. 128
  2. B. 256
  3. C. 32
  4. D. 64

Correct answer: C. 32

The whole matrix is 1 KB = 32 blocks and the block index of element (i, j) is 2i + ⌊j/8⌋, all different mod 64, so there are no conflicts: only 32 compulsory misses. The large-stride intuition (every access misses) fails when the data fits in the cache.

More Computer Organization and Architecture questions

Exams that ask this topic