We use privacy-friendly product analytics (no session recording, PII masked) to improve OpenStem. Load analytics? Privacy Policy
Software: explore STEM content · openstem
Explore STEM Content
Search the community's STEM library — free to study, yours to make your own.
Software
Programming, algorithms and systems on openstem — flashcards, notes, quizzes, sketches and flowcharts shared by the community. Study free, or clone anything into your library.
What are the 'three pillars' of observability, and what does each answer?1 / 8
Metrics (numeric time series — request rate, error rate, latency) answer 'is something wrong, and roughly how much?'. Logs (discrete timestamped events with detail) answer 'what exactly happened at this point?'. Traces (the causal chain of spans across services for one request) answer 'where in the call chain did the problem happen?'. Real debugging usually moves between all three: a metric alerts, a trace localizes the slow hop, a log explains why.
What is CSP, and what are its two core composition operators?1 / 7
Communicating Sequential Processes (Hoare, 1978) is a process algebra where processes interact only through synchronous, rendezvous-style events on named channels — there is no shared memory. The two core operators are prefixing, a → P (perform event a, then behave as P), and choice, P □ Q (external choice between P and Q, resolved by the environment's first event). Parallel composition P ‖ Q synchronises processes on shared alphabet events.
Software
Software · L5 · Process Calculi & Concurrency Theory
AA Future<Response> that completes with a status code and bodyBThe decoded JSON directlyCA Stream of response chunksDNothing — it must be awaited inside a StreamBuilder
An optimization technique that solves problems by breaking them into overlapping subproblems and storing results to avoid redundant computation. Requires optimal substructure (optimal solution contains optimal subproblem solutions) and overlapping subproblems.
State each ACID property precisely, distinguishing Consistency from Isolation.1 / 10
Atomicity: a transaction's effects are all-or-nothing; a partial failure rolls everything back. Consistency: each committed transaction moves the database from one state satisfying all declared constraints (keys, checks, triggers) to another — it is a property the application+constraints uphold, not the engine alone. Isolation: concurrent transactions produce a result equivalent to some serial schedule (to the degree the chosen level guarantees). Durability: once commit returns, the changes survive a crash, usually via a write-ahead log (WAL) flushed/fsynced before acknowledgment.
Contrast the REQUIRED, REQUIRES_NEW, and NESTED transaction propagation modes.1 / 10
REQUIRED (default) joins the caller's transaction or starts one if none exists. REQUIRES_NEW always suspends any existing transaction and runs in an independent new one that commits/rolls back on its own — useful for audit logs that must persist even if the outer call rolls back. NESTED runs inside the current transaction at a JDBC savepoint, so it can roll back to that savepoint without aborting the outer transaction (requires savepoint support, e.g. the DataSourceTransactionManager on JDBC).
P is the class of decision problems solvable by a deterministic Turing machine in polynomial time. NP is the class of decision problems whose YES-instances have certificates verifiable in polynomial time by a deterministic Turing machine. P ⊆ NP; whether P = NP is the central open question in theoretical computer science.
What is XSS (Cross-Site Scripting) and how do you prevent it?1 / 10
XSS injects malicious scripts into pages viewed by others, running in their browser to steal cookies/tokens or perform actions. Prevent by escaping/encoding output, using a Content-Security-Policy, and never inserting untrusted data into the DOM as HTML (use textContent, not innerHTML).
What Is a Replica Set? A replica set is a group of mongod processes holding the same data set. One member is the primary and accepts all writes; the rest are secondaries that replicate the primary's operations from its oplog (operation log)
How do VPC global scope and regional subnets shape a multi-region design?1 / 10
A VPC network is global, so subnets (each tied to one region) share a single private routing domain and can talk over internal IPs without peering or VPNs. This lets you place workloads in multiple regions inside one VPC, but subnet CIDR ranges are regional resources and must be planned to avoid overlap, especially before peering with other VPCs.
Top-Down vs. Bottom-Up Parsing LL(1) parsers work top-down: starting from the grammar's start symbol, they predict which production to expand using the current nonterminal and one token of lookahead, requiring FIRST sets of alternative prod
Why prefer short-lived access tokens with refresh tokens?1 / 10
Short access-token lifetimes limit the damage of a leaked token, while a longer-lived refresh token (stored more securely and revocable server-side) lets clients obtain new access tokens without re-login.
What is a recursive type and when is it needed?1 / 10
A type that references itself in its definition, used to model recursive data structures like JSON, trees, or linked lists. e.g. `type JSONValue = string | number | boolean | null | JSONValue[] | { [k: string]: JSONValue }`
What is the difference between leader-based (single-master) and leaderless replication?1 / 8
Leader-based replication routes all writes through one designated node, which propagates changes to followers — simple to reason about, but the leader is a bottleneck and failover requires electing a new one. Leaderless replication (e.g. Dynamo-style) lets any replica accept a write and relies on quorum reads/writes plus conflict resolution to stay consistent, trading simplicity for higher write availability.
What is the difference between a single-subscription and a broadcast Stream?1 / 10
A single-subscription stream allows only one listener over its lifetime and buffers events until then; a broadcast stream allows many simultaneous listeners and does not buffer for late subscribers.