Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

133 bites

Test yourself: Top 30 intermediate Go & Rust interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Intermediate everything in Go & Rust, page 3

intermediate2 min read

Compare Go's error tuples to Rust's Result for I/O

Tests trade-offs between Go's explicit error returns and Rust's Result type. Contrast Go's inline err checks with Rust's ? operator, noting verbosity versus compile-time exhaustiveness. Never call Result an exception or claim Go ignores errors.

intermediate2 min read

Compare efficient line-by-line file reading in Go and Rust

Go uses bufio.Scanner with ScanLines/Scan(); Rust uses BufReader with lines() or read_line().

intermediate2 min read

Explain Cargo features and how to define and enable them

This tests conditional compilation and optional dependency design in Rust. A strong answer outlines the [features] table, cfg attribute gating, and consumer enablement via --features or default features.

intermediate2 min read

Difference between go build and go install? Cross-compile for ARM64 Linux?

Tests Go toolchain artifact placement and native cross-compilation. A strong answer distinguishes go build (current directory) from go install ($GOBIN), then sets GOOS=linux GOARCH=arm64 for cross-compilation.

intermediate2 min read

How does cargo differentiate unit and integration tests by location?

This tests Rust test layout conventions. Unit tests live inside src files in cfg(test) modules; integration tests go in top-level tests/ files as separate crates. Red flag: saying integration tests need cfg(test) or can use private APIs.

intermediate2 min read

What Go tool detects data races and how do you invoke it?

This tests Go's built-in race detector. A strong answer names the -race flag, notes it instruments memory accesses to catch concurrent unsynchronized reads/writes, and shows go test -race. A red flag is confusing it with static analysis or external tools.

intermediate2 min read

Go select vs Rust select! fairness and determinism

This tests runtime fairness in concurrent primitives. Contrast Go's pseudo-random case selection with Tokio's randomized default and its opt-in biased; top-down mode. Red flag: claiming Go uses source order or that Rust randomization is unavoidable.

intermediate2 min read

What is Go's context package and how do you use WithCancel?

This tests cancellation propagation. A good answer says Context carries deadlines, signals; derive a child with WithCancel, pass it to worker, then call cancel to unblock ctx.Done. Bad: storing context in structs, leaking cancel functions, or ignoring Done.

intermediate2 min read

Static dispatch with impl Trait versus dynamic dispatch with Box<dyn Trait>

Tests monomorphization versus vtables. Note: static dispatch monomorphizes for zero-cost abstraction but bloats code; dynamic dispatch uses vtables for smaller binaries but adds indirection.

intermediate2 min read

Explain Go's empty interface, safe usage, and runtime risks

Interface{} (alias any) holds values; unpack with type switches or ok assertions; risks are panics from bare assertions and nil interface vs nil concrete value confusion.

intermediate2 min read

How does the question mark operator use From to unify error types?

This tests Rust error conversion mechanics. You define a unified enum error and implement From for each source error so ? automatically converts via From::from. A red flag is suggesting manual match or map_err on every call instead of trait-based conversion.

intermediate2 min read

What is the difference between unwrap and expect on Option and Result?

It tests your Rust error-handling discipline and justified panics. Both extract values or panic, but expect adds a custom message. Use them only for unrecoverable invariant violations, not routine errors. A red flag is using them as lazy error propagation.

intermediate2 min read

Difference between errors.Is and errors.As in Go

This tests error-chain inspection in Go. errors.Is checks sentinel equality through wrapping, such as os.ErrNotExist. errors.As extracts a custom type, like os.PathError, into a variable. A red flag is using direct == or type assertions on wrapped errors.

intermediate2 min read

How does Rust ownership avoid Go GC's non-deterministic pauses?

Tests if you know Rust's compile-time ownership eliminates GC pauses by making deallocation deterministic at scope boundaries. A strong answer contrasts Go's STW with Rust's immediate Drop and zero-cost compile-time checks.

intermediate2 min read

Explain the difference between mod and use in Rust

Mod tells the compiler to compile a file into the crate tree; use brings an existing path into scope as a shortcut.

intermediate2 min read

What is the purpose of the internal directory in Go?

Tests Go visibility boundaries beyond exported vs unexported. A strong answer states that internal is compiler-enforced module privacy, while lowercase is only package-private. Red flag: calling internal a naming convention rather than a build boundary.

Why does Go forbid circular dependencies, and how do you resolve them?
intermediate2 min read

Why does Go forbid circular dependencies, and how do you resolve them?

Cycles break incremental compilation; resolve by moving logic down, merging coupled packages, or using dependency injection.

intermediate2 min read

Sum Some values in Vec<Option<i32>>, ignoring None

Tests Rust Option handling and null-safety design. A strong answer uses map, unwrap_or, flatten, or match to skip Nones safely, and explains Option replaces null pointers with explicit enum variants. Red flag: using unwrap in a loop or suggesting null checks.

intermediate2 min read

What type replaces String for read-only function parameters in Rust?

Use &str; it borrows without ownership, accepts literals and String via coercion, and avoids clones.

intermediate1 min read

How do you safely share a Go map across goroutines?

Tests Go memory model. Answer: maps are not concurrency-safe and risk panic or corruption; use sync.RWMutex with map for read-heavy cases or sync.Map for cache-like patterns. Red flag: suggesting runtime.GOMAXPROCS or channel-only access without justification.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles