Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

36 bites

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

Easy interview questions in Go & Rust, page 2

easy2 min read

How do you initialize and manage Go dependencies?

Init with go mod init; use go get and go mod tidy; go.mod sets path and versions, go.sum stores checksums for verified builds.

easy2 min read

What is the difference between Cargo.toml and Cargo.lock?

Cargo.toml declares broad requirements; Cargo.lock pins exact resolved versions.

easy2 min read

Read a file into a byte slice in Go and Rust

This tests standard-library convenience APIs for slurping files. In Go, use os.ReadFile (1.16+) returning ([]byte, error). In Rust, use std::fs::read returning Result<Vec<u8>>. A red flag is opening a file and looping over reads when a one-liner exists.

easy2 min read

Build a TCP server in Go and Rust using standard libraries

Tests standard-library networking APIs in both languages. Strong answer: Go's net.Listen with Accept loop vs Rust's std::net::TcpListener::bind and incoming iterator. Red flag: reaching for HTTP or async frameworks instead of core TCP primitives.

easy2 min read

Serialize a Go struct to JSON and contrast with Rust

This tests fluency in Go's encoding/json versus Rust's derive macro ecosystem. Go: call json.Marshal on exported fields; Rust: derive Serialize, then serde_json::to_string. Red flag: claiming Rust uses std-only serialization or that Go needs external crates.

easy2 min read

How do you write a table-driven test in Go?

Tests idiomatic Go test design. A strong answer: slice/map of structs with inputs/expected outputs, loop with t.Run for named subtests, and cite DRY code, parallelization, and failure isolation. Red flag: separate Test functions per case or omitting t.Run.

easy2 min read

How does Rust differentiate unit and integration tests?

Tests Rust test layout and privacy. Unit tests sit in src/ under #[cfg(test)] and call private functions via super::. Integration tests go in tests/ as external crates. Wrong: claiming it blocks private testing or merging them into src/.

easy2 min read

What is go test -race and when is it crucial?

This tests knowledge of Go's race detector. A strong answer says -race instruments code to detect racy reads/writes, finds data races not deadlocks, and is crucial for concurrent apps under load.

easy2 min read

What is go generate and how does it differ from make?

This tests whether go generate is a pre-build code generator, not a build system. Strong answers cover //go:generate directives, no dependency analysis, and committing generated files. A red flag is calling it a make replacement or an automatic build step.

easy2 min read

What are Rust's two macro categories and use cases?

Name macro_rules! for syntax like vec!, and procedural macros for custom derive on structs.

easy2 min read

What does unsafe enable in Go and Rust? List two operations.

Go unsafe enables pointer arithmetic and type punning; Rust unsafe permits raw pointer dereferencing and FFI.

easy2 min read

Purpose of Go import C and Rust equivalent mechanism

This tests FFI entry points: Go's import "C" activates cgo to reference C symbols directly, while Rust uses an unsafe extern "C" block to declare external functions. A red flag is calling either a normal import or omitting unsafe in Rust.

easy2 min read

Pass a string from Go and Rust to C safely

This tests FFI ownership and null-termination. In Go, use C.CString then C.free it. In Rust, create a std::ffi::CString, bind it to a let, then pass as_ptr while the binding lives. Red flag: claiming Rust is auto-safe without mentioning the temp-drop gotcha.

easy1 min read

Structuring a Go CLI that fetches a URL

Parse args with the flag package, http.Get the URL, check err and status, defer resp.Body.Close, copy body to stdout, exit non-zero on failure.

easy2 min read

Handling Result and errors in a Rust web handler

Handler returns Result, the ? operator early-returns errors, a custom error type implements IntoResponse to map to 500, success returns 200 with data.

easy1 min read

In-memory rate limiter middleware in Go

Use a token-bucket limiter (golang.org/x/time/rate), guard a per-client map with sync.Mutex, wrap http.Handler so requests over the limit get 429.

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