Basics of Memory Interview Questions and Answers: Model Answers, Numericals, and Traps

Build interview-ready memory answers from first principles. Learn address-capacity calculations, hierarchy, SRAM versus DRAM, cache averages, byte order, and the traps that follow-up questions expose.

KnowledgeGate Team

Exam prep & CS education

Updated 4 Dec 20265 min read
Basics of Memory Interview Questions and Answers: Model Answers, Numericals, and Traps

Candidates often memorise SRAM, DRAM, cache, and address bus but struggle when one value changes or an interviewer asks why. A strong answer names the definition, states the assumption, works the calculation, and explains the trade-off. A screening answer may stop at the distinction; a deeper follow-up can change a value or ask for the reason. Timings below are illustrative teaching assumptions.

What computer memory means in an interview answer

Question: What is computer memory?

Model answer: Computer memory is an addressable collection of storage locations that holds instructions, data, and intermediate results. An address identifies a location, while the location size tells us how many bits it selects.

Keep the units separate:

  • A bit is one binary digit.

  • A nibble is 4 bits.

  • A byte is 8 bits.

  • A word is the processor's architecture-dependent natural data unit.

For example, 1010 0111(base 2) = A7(base 16). One byte can be written as eight binary digits or two hexadecimal digits.

Is a word always 4 bytes? No. A byte is 8 bits in the systems discussed here, but word size depends on the architecture. Byte, location, and word are not synonyms.

Address lines, addressability, and capacity

Use two formulas:

  • Number of locations = 2^n for n address lines.

  • Capacity = number of locations x bits per location.

A 16-bit address bus selects 2^16 = 65,536 locations, addressed 0 to 65,535, or 0x0000 to 0xFFFF.

For byte-addressable memory:

65,536 x 1 byte = 65,536 bytes = 64 KiB

If each address selects a 16-bit word:

65,536 x 16 bits = 1,048,576 bits

1,048,576 / 8 = 131,072 bytes = 128 KiB

Capacity doubles because each location is twice as wide.

How many address lines are needed for 1 MiB of byte-addressable memory? Since 1 MiB = 2^20 bytes, the answer is 20.

There are 65,536 locations; the highest address is 65,535. If KB appears instead of KiB, state the binary-unit assumption.

Address decoder maps A15–A0 to locations and compares 8-bit and 16-bit location capacities.

Why memory is a hierarchy

Why do computers need registers, cache, main memory, and secondary storage? No technology maximises speed and capacity while minimising cost per bit and preserving data. Registers favour immediate access, cache holds useful blocks nearby, main memory provides working capacity, and SSDs or HDDs provide larger persistent storage.

Temporal locality is reuse of recent data, such as a loop counter. Spatial locality is use of nearby data, such as A[0] through A[3]. Cache therefore stores blocks of neighbouring bytes.

The Computer Organization and Architecture subject map connects memory hierarchy with cache, I/O, instructions, and processor design. Secondary storage is not main memory, and the CPU does not use every level identically.

RAM, ROM, SRAM, and DRAM

RAM is normally volatile working memory. ROM is non-volatile memory used mainly for stored instructions or fixed data, but not every ROM technology is permanently unchangeable.

Point

SRAM

DRAM

Textbook cell

Bistable latch, often shown as six transistors

One transistor and one capacitor

Refresh

None while powered

Periodic refresh required

Relative speed

Faster

Slower

Density and cost

More area per bit, costlier at scale

Higher density, cheaper per bit

Volatility

Volatile

Volatile

Common role

Cache

Main memory

Does static RAM retain data without power? No. Static means no periodic refresh while powered. SRAM is still volatile.

Why not build all main memory from SRAM? SRAM uses more chip area per bit and becomes costlier at large capacities. DRAM accepts refresh overhead for the higher density needed in main memory.

Cache hits, misses, and average access time

A hit finds the block in cache; a miss fetches it from a lower level. Hit rate is the hit fraction, miss rate is 1 - hit rate, and service time is the time charged for either outcome.

Check whether miss time includes cache lookup. Here a hit is 4 cycles and an inclusive miss is 100, so do not add the lookup again.

For eight accesses with six hits and two misses:

Total = (6 x 4) + (2 x 100) = 24 + 200 = 224 cycles

Average = 224 / 8 = 28 cycles per access

Hit rate = 6 / 8 = 75%

With seven hits and one miss:

Total = (7 x 4) + (1 x 100) = 28 + 100 = 128 cycles

Average = 128 / 8 = 16 cycles per access

One fewer miss cuts the average by 28 - 16 = 12 cycles per access because the miss is costly. The Basics of Memory MCQs link is for solved question-bank practice; this post focuses on the assumptions behind capacity and cache calculations. Associative Mapping MCQs extend the cache work to tag, index, offset, and placement.

Hit and miss traces compare average access cycles for two cache hit rates.

Byte order and memory access methods

How is 0x12345678 stored from address 0x1000?

Address

Little-endian

Big-endian

0x1000

78

12

0x1001

56

34

0x1002

34

56

0x1003

12

78

Endianness changes byte order, not the bits inside each byte.

  • Sequential access scans records until a target such as R6.

  • Direct access jumps near a disk block, then locates data within that area.

  • Random access selects a location such as address 6 directly.

  • Associative access searches by content or a tag such as 1010.

Is associative memory ordinary RAM? No. RAM is selected by address; associative or content-addressable memory matches content or key bits.

How to answer depth questions and traps

Use four steps: define the term, state the assumption, apply the formula or comparison, then give a ten-second example. A screening may stop after a comparison; a deeper discussion may continue into capacity, locality, cache performance, or trade-offs. This is possible, not an employer rule.

Keep these corrections ready:

  • Highest address is not the number of locations.

  • Word size is not implied by address-bus width.

  • Static does not mean non-volatile.

  • Cache is not permanent storage.

  • Cache and virtual memory solve different bottlenecks.

  • Capacity needs a byte-addressable or word-addressable assumption.

Three rapid probes connect the ideas:

  1. Which is faster, SRAM or DRAM, and why is DRAM still used? SRAM is faster, but DRAM gives higher density and lower cost per bit at large capacities.

  2. Does a 20-bit address bus always mean 1 MiB? Only when each of its 2^20 addresses selects one byte.

  3. What if miss service time rises while hit rate stays fixed? Average access time rises in proportion to miss rate under this inclusive-time model.

The 30-second version and the best next step

Memory is an addressable hierarchy. With n address bits, a system selects 2^n locations, but capacity also depends on location width. Registers and cache favour speed, main memory balances speed and capacity, and secondary storage provides larger persistent capacity. SRAM commonly serves cache without refresh, while DRAM commonly serves main memory with refresh. Cache performance depends heavily on hit rate and miss cost.

If hierarchy, SRAM versus DRAM, or address-capacity questions were difficult, continue with the Computer Architecture and Organisation course. If the concepts are clear but spoken answers become unstructured, use the Interview and Resume Preparation course.

For more practice routes, browse the KnowledgeGate learning library to revise mistakes and choose the next concept.