0
0
HLDsystem_design~20 mins

Write-through and write-back caching in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Caching Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference between write-through and write-back caching

Which statement correctly describes the main difference between write-through and write-back caching?

AWrite-through caching updates the main memory immediately on every write, while write-back caching updates main memory only when the cache block is replaced.
BWrite-back caching updates the main memory immediately on every write, while write-through caching updates main memory only when the cache block is replaced.
CWrite-through caching never updates the main memory, only the cache, while write-back caching updates both simultaneously.
DWrite-back caching writes data directly to main memory without using cache.
Attempts:
2 left
💡 Hint

Think about when the main memory gets updated in each caching method.

Architecture
intermediate
2:00remaining
Choosing caching strategy for a banking system

You are designing a caching layer for a banking system where data accuracy is critical. Which caching strategy is most appropriate?

AWrite-through caching to ensure data is always consistent between cache and main memory.
BWrite-back caching to improve performance by delaying writes to main memory.
CNo caching to avoid any risk of stale data.
DWrite-back caching combined with periodic full memory flushes.
Attempts:
2 left
💡 Hint

Consider the importance of data accuracy and consistency in banking.

scaling
advanced
2:30remaining
Scaling write-back cache in distributed systems

In a distributed system using write-back caching, what is a major challenge when scaling to many nodes?

AReducing cache size to fit all data in memory.
BIncreasing write latency due to immediate writes to main memory.
CEnsuring cache coherence to prevent stale data across nodes.
DAvoiding network partitioning by disabling caching.
Attempts:
2 left
💡 Hint

Think about how delayed writes affect data consistency across multiple nodes.

tradeoff
advanced
2:30remaining
Trade-offs between write-through and write-back caching

Which option correctly describes a trade-off when choosing write-back caching over write-through caching?

AWrite-back caching eliminates the need for cache coherence protocols.
BWrite-back caching improves write performance but risks data loss on power failure.
CWrite-back caching reduces cache complexity but increases main memory writes.
DWrite-back caching guarantees data consistency but lowers system throughput.
Attempts:
2 left
💡 Hint

Consider performance benefits versus risks of delayed writes.

estimation
expert
3:00remaining
Estimating memory write load with write-through vs write-back

A system writes data 1000 times per second. With write-through caching, every write updates main memory immediately. With write-back caching, only 10% of writes cause main memory updates due to cache block replacements. How many main memory writes per second occur with write-back caching?

A900 writes per second
B1000 writes per second
C10 writes per second
D100 writes per second
Attempts:
2 left
💡 Hint

Calculate 10% of 1000 writes per second.