System Design – Questions & Answers
Functional vs Non■Functional Requirements
Functional requirements define what the system should do, such as features and workflows. Non■functional
requirements define quality attributes like performance, scalability, availability, security, and maintainability.
Experienced designers prioritize NFRs early because they heavily influence architecture decisions.
CAP Theorem
CAP theorem states that in a distributed system facing a network partition, you must choose between Consistency
and Availability. Real systems choose trade■offs per use■case, such as CP for payments and AP for social
feeds.
Horizontal vs Vertical Scaling
Vertical scaling increases resources on a single machine, while horizontal scaling adds more machines.
Horizontal scaling improves availability and elasticity but introduces distributed system complexity.
Java Fundamentals – Questions & Answers
JDK vs JRE vs JVM
JVM executes bytecode and manages memory. JRE includes JVM and core libraries to run applications. JDK
includes JRE plus development tools such as compiler and debugger.
Stack vs Heap Memory
Stack stores method frames and local variables and is thread■local. Heap stores objects and is shared across
threads and managed by garbage collection.
Object■Oriented Concepts – Questions & Answers
Encapsulation, Inheritance, Polymorphism, Abstraction
Encapsulation hides internal state, abstraction exposes essential behavior, inheritance enables reuse, and
polymorphism allows different implementations through a common interface.
Multithreading & Concurrency – Questions & Answers
Race Condition
Occurs when multiple threads access shared data concurrently and results depend on execution order. Prevented
using synchronization, locks, immutability, or atomic variables.
volatile Keyword
volatile guarantees visibility and ordering of reads and writes across threads but does not provide atomicity.
Garbage Collection – Questions & Answers
Young vs Old Generation
Most objects die young and are collected in the young generation. Long■lived objects are promoted to the old
generation, optimizing GC performance.
Collections Framework – Questions & Answers
HashMap Internals
HashMap uses hashing to store key■value pairs in buckets. Collisions are handled using linked lists or balanced
trees, and resizing occurs when load factor threshold is exceeded.
String – Questions & Answers
Why String is Immutable
String immutability ensures thread safety, security, caching efficiency, and reliable hash codes for use as map
keys.
JVM Internals – Questions & Answers
Class Loading Process
Includes loading, linking (verification, preparation, resolution), and initialization. ClassLoader hierarchy plays a key
role in application behavior.