Interview Q&A · 8 questions · 5 answered publicly
Elixir Fundamentals Interview Questions
Ordered by how often they're asked. Sign in free to see every answer, rate your confidence and run timed mock interviews.
-
Most asked What is the BEAM and why does Elixir use it?
Summary
The BEAM is the Erlang virtual machine, designed for highly concurrent, fault-tolerant systems. It runs millions of lightweight, isolated processes with preemptive scheduling across cores, and supports hot code upgrades.
Longer Answer
Elixir compiles to BEAM bytecode and interoperates with Erlang libraries and OTP.
Key Points
- Lightweight isolated processes.
- Preemptive scheduling, soft real-time.
- OTP for fault tolerance.
Deep dive: Elixir Fundamentals: Processes
-
Most asked How does pattern matching work in Elixir?
Summary
= is the match operator: the left side is a pattern matched against the right side, binding variables; a mismatch raises MatchError. Patterns are used in function heads, case, with and receive; ^ pins an existing value.
Longer Answer
Tagged tuples like {:ok, value} and {:error, reason} rely on pattern matching.
Key Points
- = matches, not assigns.
- Destructure tuples, lists, maps.
- ^ pins; _ ignores.
Deep dive: Elixir Fundamentals: Pattern Matching
-
Most asked What is a GenServer?
Summary
An OTP behaviour for a process that holds state and handles synchronous calls (handle_call), asynchronous casts (handle_cast) and other messages (handle_info). A client API wraps the message passing.
Longer Answer
Run GenServers under supervisors; avoid slow work in callbacks because messages are processed one at a time.
Key Points
- Stateful server process.
- call (sync) vs cast (async).
- Supervised; one message at a time.
-
Most asked What does 'let it crash' mean?
Summary
Instead of handling every unexpected error defensively, let the process crash and rely on a supervisor to restart it in a known-good state. Expected errors are still handled with tagged tuples.
Longer Answer
This keeps code simple and isolates failures, because processes share no memory.
Key Points
- Supervisors restart failures.
- Isolation limits blast radius.
- Handle expected errors explicitly.
Deep dive: Elixir Fundamentals: Let It Crash
-
Most asked What are Phoenix LiveView and Ecto?
Summary
LiveView renders interactive, real-time UIs on the server and updates the browser over a WebSocket, without a separate JavaScript frontend. Ecto is Elixir's database toolkit: schemas, changesets for casting and validation, composable queries and migrations.
Longer Answer
Both are part of the Phoenix ecosystem; Oban adds background jobs on PostgreSQL.
Key Points
- LiveView: server-rendered real-time UI.
- Ecto: schemas, changesets, queries.
- Phoenix PubSub for broadcasts.
Deep dive: Elixir Fundamentals: Phoenix Ecosystem
- What supervision strategies exist?
- When would you use `with` in Elixir?
- What's the difference between Enum and Stream?