OS
OpenStem
@openstem · Joined Jul 2026
7420 public items8 groups
Flashcards10 cards
What is the GCP equivalent of AWS EC2 and S3?1 / 10
Compute Engine = virtual machines (≈ EC2). Cloud Storage = object storage in buckets (≈ S3). Cloud Functions = serverless functions (≈ Lambda). GKE = managed Kubernetes (≈ EKS). The cloud primitives map closely across providers.
Core Services
@openstem
Core ServicesFlashcards10 cards
What sits at the top of the GCP resource hierarchy?1 / 10
The Organization node is the root of the hierarchy, representing a company. Below it are Folders, then Projects, then resources. Policies set higher up are inherited downward.
Cloud Fundamentals
@openstem
Cloud FundamentalsFlashcards10 cards
What language do you write Terraform configuration in?1 / 10
HCL (HashiCorp Configuration Language), a declarative language for describing infrastructure in .tf files. Terraform can also accept equivalent JSON.
Terraform Fundamentals
@openstem
Terraform FundamentalsFlashcards10 cards
What is Infrastructure as Code (IaC)?1 / 10
Managing and provisioning infrastructure through declarative configuration files instead of manual console clicks. Benefits: version control, repeatability, code review, and automated provisioning. Terraform is a leading provider-agnostic IaC tool.
IaC Fundamentals
@openstem
IaC FundamentalsFlashcards5 cards
What is a loop in programming?1 / 5
A loop is an instruction that repeats a block of steps more than once. Instead of writing the same line ten times, you write it once inside a loop.
Software · L2 · Loops: Doing Things Again and Again
@openstem
Software · L2 · Loops: Doing Things Again and AgainFlashcards5 cards
What is a variable?1 / 5
A variable is like a labelled box. You give it a name and put a value inside. The program can look at or change that value whenever it needs to.
Software · L2 · Variables: Labelled Boxes for Values
@openstem
Software · L2 · Variables: Labelled Boxes for ValuesFlashcards10 cards
What is a closure in JavaScript?1 / 10
A closure is a function that remembers the variables from its enclosing lexical scope, even after that scope has finished executing. Every function in JS is a closure.
Closures & Scope
@openstem
Closures & ScopeFlashcards9 cards
What is the prototype chain?1 / 9
Every JS object has an internal `[[Prototype]]` link. When you access a property, JS looks on the object, then up the chain until it reaches `null`. This is how inheritance works — all arrays inherit from `Array.prototype`, which inherits from `Object.prototype`.
Prototypes & Classes
@openstem
Prototypes & ClassesFlashcards10 cards
What are generics in TypeScript?1 / 10
Generics let you write reusable code that works with multiple types while preserving type safety. `function identity<T>(x: T): T` returns the same type it receives — T is inferred at the call site.
Generics & Utility Types
@openstem
Generics & Utility TypesFlashcards10 cards
What is a discriminated union and why is it useful?1 / 10
A union of object types each with a shared literal property that TypeScript uses to narrow: `type Shape = { kind: 'circle'; r: number } | { kind: 'rect'; w: number; h: number }`. The `kind` discriminant lets TypeScript know which branch you're in.
Patterns & Best Practices
@openstem
Patterns & Best PracticesFlashcards10 cards
What is a .d.ts declaration file?1 / 10
A file containing only type declarations and no runtime code; it describes the shape of existing JavaScript so TypeScript can type-check against it.
Modules & Declaration Files
@openstem
Modules & Declaration FilesFlashcards8 cards
Explain list comprehension vs a generator expression.1 / 8
A list comprehension `[x for x in it]` eagerly builds the whole list in memory. A generator `(x for x in it)` yields lazily — far more memory-efficient for large or infinite sequences.
Comprehensions & Iteration
@openstem
Comprehensions & IterationFlashcards8 cards
What is the difference between `__str__` and `__repr__`?1 / 8
`__repr__` should return an unambiguous technical string for developers (ideally eval-able). `__str__` returns a human-readable string for end users. `str()` calls `__str__`; if missing, falls back to `__repr__`. Always implement `__repr__` at minimum.
OOP & Classes
@openstem
OOP & ClassesFlashcards10 cards
What problem does useCallback solve, and when is it pointless?1 / 10
It memoizes a function identity across renders so memo-wrapped children or effect dependencies don't trigger unnecessarily. Pointless if the consumer isn't memoized — you pay the memoization cost for no benefit.
Hooks
@openstem
HooksFlashcards10 cards
What is prop drilling and how do you solve it?1 / 10
Passing props through many intermediate components that don't use them — just to reach a deeply nested child. Solve with React Context, a state management library (Zustand, Redux), or component composition.
State & Context
@openstem
State & ContextFlashcards8 cards
What are the three DFS traversal orders for a binary tree?1 / 8
In-order (Left → Root → Right) — visits BST nodes in sorted order. Pre-order (Root → Left → Right) — useful for serialization/copy. Post-order (Left → Right → Root) — useful for deletion and evaluating expression trees.
Trees & BST
@openstem
Trees & BSTFlashcards8 cards
When would you choose a hash map over a balanced BST?1 / 8
Hash map for O(1) average lookups when you only need exact-match and ordering doesn't matter. BST (O(log n)) when you need sorted traversal, range queries, or predecessor/successor lookups.
Structures & Trade-offs
@openstem
Structures & Trade-offsFlashcards8 cards
What is the recurrence relation for merge sort?1 / 8
T(n) = 2T(n/2) + O(n). By the Master Theorem: O(n log n) time. It requires O(n) auxiliary space and is stable (preserves relative order of equal elements).
Sorting Algorithms
@openstem
Sorting AlgorithmsFlashcards10 cards
What is the CAP theorem?1 / 10
A distributed system can guarantee at most two of: Consistency (all nodes see the same data), Availability (every request gets a response), Partition tolerance (works despite network splits). Since partitions are unavoidable, the real trade-off is CP vs AP.
CAP & Consistency
@openstem
CAP & ConsistencyFlashcards9 cards
When would you add a cache and what are the main invalidation strategies?1 / 9
Add a cache when reads vastly outnumber writes and slight staleness is acceptable. Strategies: write-through (cache + DB together), write-back (write cache, flush later), TTL expiry, and cache-aside (app manages cache). Invalidation is the hard part.
Caching
@openstem
CachingFlashcards9 cards
What is a database index and how does it work?1 / 9
An index is typically a B-tree data structure that maps column values to row locations, enabling fast lookups without a full table scan. Read speed improves from O(n) to O(log n). Each write must update all relevant indexes — there's a write overhead.
Indexes & Performance
@openstem
Indexes & PerformanceFlashcards9 cards
What is a window function and how does it differ from GROUP BY?1 / 9
A window function computes a value across a set of rows (the 'window') without collapsing them into one row like GROUP BY does. Each input row gets an output row. `OVER (PARTITION BY ... ORDER BY ...)` defines the window.
Window Functions
@openstem
Window FunctionsFlashcards10 cards
What is the difference between `git fetch` and `git pull`?1 / 10
`git fetch` downloads remote changes into the remote-tracking branch but does NOT change your working directory. `git pull` = `git fetch` + `git merge` (or rebase with `--rebase`). Fetching first lets you review changes before integrating.
Collaboration & PR Workflow
@openstem
Collaboration & PR WorkflowFlashcards10 cards
What is a fast-forward merge?1 / 10
When the target branch has no new commits, Git simply moves its pointer forward to the source branch's tip, creating no merge commit.
Branching & Merging
@openstem
Branching & MergingFlashcards10 cards
What is a goroutine?1 / 10
A lightweight thread managed by the Go runtime, started with the `go` keyword. Goroutines are multiplexed onto OS threads by the scheduler, are very cheap (~2KB initial stack), so you can run hundreds of thousands concurrently.
Goroutines & Channels
@openstem
Goroutines & ChannelsFlashcards10 cards
How do interfaces work in Go?1 / 10
Go interfaces are satisfied implicitly — a type implements an interface simply by having the required methods, with no `implements` keyword. This enables structural typing and decoupling. The empty interface `interface{}` (or `any`) matches every type.
Types & Interfaces
@openstem
Types & InterfacesFlashcards9 cards
How does Go conventionally handle errors?1 / 9
Functions return an `error` as the last return value, and callers check `if err != nil`. Errors are ordinary values, not exceptions, making control flow explicit.
Errors & Idioms
@openstem
Errors & IdiomsFlashcards10 cards
What is `Option<T>` and why does Rust have no null?1 / 10
`Option<T>` is an enum with variants `Some(T)` and `None`. Rust has no null pointer — absence of a value is encoded in the type system, forcing you to handle the None case explicitly. This eliminates null-pointer dereferences.
Enums & Error Handling
@openstem
Enums & Error HandlingFlashcards10 cards
What is a trait in Rust?1 / 10
A trait defines shared behavior as a set of method signatures that types can implement. It is Rust's mechanism for interface-like polymorphism and abstraction over types.
Traits & Generics
@openstem
Traits & GenericsFlashcards10 cards
What is the difference between an interface and an abstract class?1 / 10
An interface declares method signatures (and default methods since Java 8) with no state; a class can implement many. An abstract class can have state, constructors, and concrete methods, but a class extends only one. Use interfaces for capability, abstract classes for shared base implementation.
OOP & Collections
@openstem
OOP & Collections