Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

132 bites

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

Interview questions in Go & Rust, page 3

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

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

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.

advanced2 min read

Design a custom Go error type with context, Is, As, and Unwrap

This tests Go 1.13 error wrapping and Unwrap conventions. Answer: struct with Err and context fields; implement Error and Unwrap; note errors.Is and errors.As walk the chain. Red flag: stringifying the error via fmt.Errorf %v, which severs unwrapping.

advanced1 min read

When to panic in Go versus Rust

Both reserve panic for unrecoverable bugs and use values, Result or error, for expected failures; Rust's type system pushes more cases to Result.

easy2 min read

How does a Go type satisfy an interface? Provide an io.Reader example.

This tests implicit structural typing in Go. A type satisfies an interface by implementing every required method with exact signatures; no declaration links them. A red flag is claiming you need an implements keyword or explicit conformance.

easy2 min read

What is the difference between defining a Rust trait and implementing it?

Define with trait and signatures; implement with impl Trait for Type and concrete bodies.

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

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.

intermediate1 min read

Value versus pointer receivers and interface satisfaction

Value-receiver methods belong to both T and *T, but pointer-receiver methods belong only to *T, so a value of T may not satisfy an interface.

advanced2 min read

Describe Rust's orphan rule and its ecosystem purpose

State that either trait or type must be local; explain this stops conflicting foreign impls; note crates.io would see silent impl collisions breaking downstream builds.

advanced1 min read

Associated types vs generic type parameters in traits

Associated types fix one type per implementer; generics allow many impls; Iterator::Item is the canonical example.

easy2 min read

What is the fundamental difference between a goroutine and an OS thread?

This tests your grasp of Go's M:N scheduler. A strong answer notes that goroutines are runtime-managed, multiplexed onto OS threads, and use far less memory per unit, enabling thousands of concurrent tasks.

easy2 min read

How do Send and Sync prevent data races? Give a Send-but-not-Sync example.

Explain Send moves values and Sync allows shared references across threads; give Cell as Send but not Sync because it has interior mutability.

easy2 min read

Buffered vs unbuffered Go channels and deadlock scenario

Tests channel synchronization semantics. Unbuffered channels block until sender and receiver rendezvous; buffered channels block only when full or empty. Deadlock: goroutine sends on unbuffered channel with no receiver.

intermediate1 min read

Sharing mutable state: Go mutex vs Rust Arc Mutex

Go uses sync.Mutex by convention; Rust wraps data in Arc<Mutex<T>> so locking is mandatory, enforced by Send/Sync and the borrow checker.

intermediate1 min read

Rust async/await vs Go goroutines

Go schedules goroutines on a built-in runtime transparently; Rust futures are inert until polled by an external runtime like Tokio, and async colors functions.

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

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.

advanced2 min read

When should Rust atomics replace a Mutex, and how do orderings work?

Atomics replace mutexes for counters; Relaxed is atomicity only, SeqCst adds global order, weaker ones skip fences on ARM.

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