Easy interview questions in Go & Rust

Compare Go's GC and Rust's ownership across performance, productivity, and safety
This tests memory-model trade-offs. Contrast Rust's compile-time ownership for deterministic, zero-cost safety against Go's GC, which optimizes simplicity and onboarding but adds runtime overhead. Red flag: calling one strictly superior.
Refactoring under Go simplicity versus Rust correctness
Rust's type system catches broken invariants at compile time so refactors are guided; Go's explicitness keeps code readable but shifts safety to tests and discipline.
How does Go's variable declaration and mutability differ from Rust?
Contrast Rust let (immutable) and let mut (mutable) with Go var and := (mutable), noting Go uses const for immutability.
Write a 1-to-5 loop in Go and Rust
Write Go's three-clause for, write Rust's 1..=5 range iterator, and contrast statement iteration with iterator consumption.
How do you append to a Go slice and why reassign?
Tests slice headers and append reallocation. A strong answer reassigns the result (s = append(s, 4)), explains that append may allocate a new backing array, and warns that ignoring the return value drops elements. Red flag: calling append without assignment.
Define a WebEvent enum with PageLoad, PageUnload, and KeyPress
Tests Rust enum syntax: unit versus tuple variants. A good answer defines WebEvent with PageLoad, PageUnload, and KeyPress(char), then instantiates WebEvent::KeyPress('q'). A red flag is forgetting the double colon or using struct variant syntax.
Define a User struct and map of IDs to pointers
Tests Go struct and map pointer basics. Outline: define User with ID and Name, initialize map[int]*User with make, insert &User literals, and note shared mutation. Red flag: writing to a nil map or storing values instead of pointers.
How do Go and Rust control visibility of functions and types?
Tests encapsulation conventions in systems languages. Go uses capitalization: uppercase exports across packages; Rust uses explicit pub keywords with module-level privacy. Red flag: claiming either uses Java-style access modifiers or runtime visibility.
Go package declaration, directory name, and import path relationship
Tests Go's separation of directory layout and package identity. A good answer states: import path is module path plus subdirectory; package clause is the in-code name; mismatch is legal and common for main or tests.
Describe Go's memory management, garbage collection, and trade-offs
Explain Go's GC recycles heap memory, the compiler stack-allocates locals, and automatic collection costs runtime overhead.
Explain Rust's Ownership and its three compiler-enforced rules
Tests your grasp of Rust's compile-time memory model. A strong answer lists the three ownership rules, links them to stack versus heap, and notes borrow checking enforces them at compile time. Red flag: calling it manual memory management.
Why are Rust's borrowing rules stricter than Go's pointers?
This tests compile-time versus runtime safety tradeoffs. A strong answer contrasts Go's aliasing with Rust's rule of one mutable or many immutable references to prevent data races without a GC. A red flag is calling Rust strict without citing race prevention.
How do you idiomatically return a recoverable error and result in Go?
This tests Go's multiple-return error idiom. A strong answer gives a (T, error) signature with error last, returns nil on success, and checks err before using the result. A red flag is suggesting panic for recoverable errors or pointer out-parameters.
What are Rust Result's variants and how does the compiler enforce handling?
This tests Rust's explicit error model. A strong answer names Ok(T) and Err(E), explains must_use warns when Results are ignored, and notes pattern matching or ? is required to extract values.
Rust's operator equivalent to Go's if err != nil return err
Tests if you know Rust's ? operator for error propagation. A strong answer names ?, explains it returns Err from the function via Result's Try and FromResidual traits, and unwraps Ok. Red flag: calling it .unwrap() or suggesting manual match is idiomatic.
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.
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.
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.
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.
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.
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