chapter
    Cache Memory, Memory Hierarchy and Address Translation Practice Questions for GATE CS

    Solve 274+ Cache Memory, Memory Hierarchy and Address Translation practice questions for GATE CS with answers and detailed solutions. Free sample questions be

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    A processor uses 32-bit addresses and has a 128 KB, 8-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    Question 2
    Level 1: Warm-up

    A processor uses 32-bit addresses and has a 32 KB, 4-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    Question 3
    Level 1: Warm-up

    An urn contains 3 red and 2 black balls. A Polya Urn process is run for draws. For how many values of is the probability of drawing a red ball on the -th draw strictly greater than ?

    Question 4
    Level 1: Warm-up

    In a Polya Urn process starting with 2 red and 3 black balls, what is the expected number of red balls drawn in 10 draws?

    Question 5
    Level 1: Warm-up

    An urn initially contains 2 red and 8 black balls. A Polya Urn process is run. For how many values of is the expected proportion of red balls in the urn exactly ?

    Question 6
    Level 1: Warm-up

    Consider the following cache tagging strategies:

    1. VIVT (Virtual Index, Virtual Tag)
    2. PIPT (Physical Index, Physical Tag)
    3. VIPT (Virtual Index, Physical Tag)

    How many of these strategies inherently avoid the synonyms problem without requiring the cache index size to be strictly less than or equal to the page size?

    Question 7
    Level 1: Warm-up

    For a computer system with a 16-bit physical address, the address is divided into tag, index, and offset fields. If the block size is 16 bytes, what is the maximum possible number of index bits, assuming the tag field must be at least 1 bit?

    Question 8
    Level 1: Warm-up

    In a direct-mapped cache system, the specific cache line to which a main memory block is mapped is uniquely determined by which part of the memory address?

    Question 9
    Level 1: Warm-up

    A system uses a 20-bit physical address and a direct-mapped cache with a block size of 32 bytes. If the cache is designed to have at least 4 lines, what is the maximum possible number of bits in the tag field?

    Question 10
    Level 1: Warm-up

    A direct-mapped cache has a capacity of 64 KB and a block size of 32 bytes. The physical address is 32 bits. How many bits are required in total to store all the tag values for the entire cache?

    Free preview ends here

    Login to view the complete practice questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Cache Memory, Memory Hierarchy and Address Translation Practice Questions for GATE CS

    Solve 274+ Cache Memory, Memory Hierarchy and Address Translation practice questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Cache Memory and Memory Hierarchy

    Your Journey Through Cache Memory

    Topic 1: Direct-Mapped Cache Addressing
    Address decomposition: Tag, Index, Offset. Simple one-to-one mapping. Foundation for all cache concepts.
    Topic 2: Set-Associative Cache
    K-way associativity. Trade-off between direct-mapped and fully associative. More flexible placement.
    Topic 3: Access Sequences and Conflict Misses
    Sequential access patterns. Conflict vs capacity misses. Real exam traps.
    Topic 4: Write Policies and Replacement
    Write-through vs write-back. Write-allocate vs no-write-allocate. LRU and other replacement algorithms.
    Topic 5: Cache Performance
    Hit rate, miss rate, miss penalty. Effective memory access time (EMAT). Multi-level cache (L1, L2).
    Topic 6: TLB and Virtual Memory Integration
    Address translation. Cache and TLB interaction. Complete system view.

    What you will master by the end:

    • Calculate tag, index, offset bits for any cache configuration
    • Analyze cache performance and hit rates
    • Understand conflict misses and replacement policies
    • Solve multi-level cache problems
    • Connect cache with virtual memory systems

    What is a Direct-Mapped Cache?

    The Core Idea

    A direct-mapped cache is the simplest cache organization where each memory block maps to exactly one specific cache line.

    Where is block number and is number of lines

    Why This Matters

    • Fast lookup: Hardware checks only one location
    • Simple design: Minimal comparison logic needed
    • Conflict problem: Two different memory blocks may compete for the same cache line

    Visual Intuition

    Main MemoryCache
    Block 0→ Line 0
    Block 1→ Line 1
    Block 2→ Line 2
    Block 3→ Line 3
    Block 4→ Line 0 (conflict)
    Block 5→ Line 1 (conflict)

    Key takeaway: One memory block has one home in the cache. No choices, no flexibility.

    Cache Memory, Memory Hierarchy and Address Translation: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Computer Organization and Architecture MCQ

    A processor uses 32-bit addresses and has a 128 KB, 8-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    1. A.

      15

    2. B.

      16

    3. C.

      20

    4. D.

      18

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: When block size is not given, use the cancellation trick — block size terms cancel out in the calculation. The Cancellation Trick: Step 1: Apply the formula. Tag = Tag = Tag = Tag = bits. Why this works: Index bits = Offset bits = Index + Offset = Tag = Address - (Index + Offset) = Address - Answer: 18 bits.
    Question 2 · Computer Organization and Architecture MCQ

    A processor uses 32-bit addresses and has a 32 KB, 4-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    1. A.

      17

    2. B.

      18

    3. C.

      19

    4. D.

      20

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: When block size is not given, use the cancellation trick — block size terms cancel out in the calculation. The Cancellation Trick: Step 1: Apply the formula. Tag = Tag = Tag = Tag = bits. Answer: 19 bits.
    Question 3 · Computer Organization and Architecture MCQ

    An urn contains 3 red and 2 black balls. A Polya Urn process is run for draws. For how many values of is the probability of drawing a red ball on the -th draw strictly greater than ?

    1. A.

      0

    2. B.

      1

    3. C.

      3

    4. D.

      5

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: The martingale property of the Polya Urn process.

    Step 1: The martingale property states that the expected proportion of red balls remains constant throughout the process.

    Step 2: Consequently, the probability of drawing a red ball at any specific step is exactly equal to the initial proportion of red balls.

    Step 3: Initial proportion = .

    Step 4: Since the probability is always exactly , it is never strictly greater than for any .

    Answer: 0.

    Question 4 · Computer Organization and Architecture MCQ

    In a Polya Urn process starting with 2 red and 3 black balls, what is the expected number of red balls drawn in 10 draws?

    1. A.

      2

    2. B.

      4

    3. C.

      5

    4. D.

      6

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: Linearity of expectation and the constant probability of drawing red.

    Step 1: The probability of drawing a red ball at any specific step is the initial proportion .

    Step 2: Here, .

    Step 3: Let be the indicator variable for drawing red on step . .

    Step 4: The total number of red balls drawn in draws is .

    Step 5: By linearity of expectation, .

    Answer: 4.

    Question 5 · Computer Organization and Architecture MCQ

    An urn initially contains 2 red and 8 black balls. A Polya Urn process is run. For how many values of is the expected proportion of red balls in the urn exactly ?

    1. A.

      1

    2. B.

      3

    3. C.

      4

    4. D.

      5

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: The martingale property of the Polya Urn process.

    Step 1: The martingale property states that the expected proportion of red balls after draws is exactly equal to the initial proportion.

    Step 2: Initial proportion = .

    Step 3: Therefore, for ANY number of draws , the expected proportion is exactly .

    Step 4: Since this holds for all , it holds for all 5 values in the set.

    Answer: 5.

    Question 6 · Computer Organization and Architecture MCQ

    Consider the following cache tagging strategies:

    1. VIVT (Virtual Index, Virtual Tag)
    2. PIPT (Physical Index, Physical Tag)
    3. VIPT (Virtual Index, Physical Tag)

    How many of these strategies inherently avoid the synonyms problem without requiring the cache index size to be strictly less than or equal to the page size?

    1. A.

      0

    2. B.

      1

    3. C.

      2

    4. D.

      3

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: Synonyms occur when different virtual addresses map to the same physical address but different cache indices.

    Step 1: VIVT uses virtual indices. Different VAs mapping to the same PA can have different indices, so it suffers from synonyms.

    Step 2: PIPT uses physical indices. Since the PA is the same, the index is the same. It inherently avoids synonyms without any size constraints.

    Step 3: VIPT uses virtual indices. It only avoids synonyms if the virtual index bits are a subset of the page offset bits (which are identical for the same PA). This requires the index size constraint.

    Step 4: Only PIPT (1 strategy) inherently avoids synonyms without the constraint.

    Answer: B

    Question 7 · Computer Organization and Architecture MCQ

    For a computer system with a 16-bit physical address, the address is divided into tag, index, and offset fields. If the block size is 16 bytes, what is the maximum possible number of index bits, assuming the tag field must be at least 1 bit?

    1. A.

      11

    2. B.

      12

    3. C.

      15

    4. D.

      16

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is an observation and boundary question, recognisable because it asks for a "maximum possible" value under a specific constraint (tag 1 bit).

    Step 1: Identify total address bits = 16.

    Step 2: Calculate offset bits. Block size = 16 bytes = bytes, so offset = 4 bits.

    Step 3: Apply the address decomposition formula: .

    Step 4: Substitute knowns: . This simplifies to .

    Step 5: To maximize the index, we must minimize the tag. The constraint states tag 1 bit. So, minimum tag = 1.

    Step 6: Maximum index = bits.

    Answer: 11 bits.

    Question 8 · Computer Organization and Architecture MCQ

    In a direct-mapped cache system, the specific cache line to which a main memory block is mapped is uniquely determined by which part of the memory address?

    1. A.

      Tag field

    2. B.

      Index field

    3. C.

      Offset field

    4. D.

      Valid bit

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a direct formula question, recognisable because it asks for the specific address field responsible for the cache line mapping.

    Step 1: Recall the address decomposition for a direct-mapped cache. The physical address is split into Tag, Index, and Offset.

    Step 2: The Index field directly selects the cache line. The mapping formula is , which is exactly what the Index bits represent.

    Step 3: The Tag identifies the block, the Offset identifies the byte, and the Valid bit is metadata, not part of the address mapping.

    Answer: The Index field.

    Question 9 · Computer Organization and Architecture MCQ

    A system uses a 20-bit physical address and a direct-mapped cache with a block size of 32 bytes. If the cache is designed to have at least 4 lines, what is the maximum possible number of bits in the tag field?

    1. A.

      12

    2. B.

      13

    3. C.

      15

    4. D.

      18

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is an observation and boundary question, recognisable because it asks for a "maximum possible" value under a specific constraint (at least 4 lines).

    Step 1: Identify total address bits = 20.

    Step 2: Calculate offset bits. Block size = 32 bytes = bytes, so offset = 5 bits.

    Step 3: Apply the address decomposition formula: .

    Step 4: Substitute knowns: . This simplifies to .

    Step 5: To maximize the tag, we must minimize the index. The constraint states "at least 4 lines". Since , the minimum index bits = 2.

    Step 6: Maximum tag = bits.

    Answer: 13 bits.

    Question 10 · Computer Organization and Architecture MCQ

    A direct-mapped cache has a capacity of 64 KB and a block size of 32 bytes. The physical address is 32 bits. How many bits are required in total to store all the tag values for the entire cache?

    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a casework question, recognisable because it requires calculating multiple fields (lines, index, offset, tag) and then combining them to find a total storage metric (total tag memory).

    Step 1: Calculate total cache lines. Cache size = 64 KB = bytes. Block size = 32 bytes = bytes. Lines = .

    Step 2: Calculate index bits. bits.

    Step 3: Calculate offset bits. bits.

    Step 4: Calculate tag bits. bits.

    Step 5: Calculate total tag memory. Total bits = Tag bits Number of lines = .

    Answer: bits.

    More practice questions in this unit