Test How Well You Really Know Rust
Rust programs either compile or they do not, and the borrow checker decides. Why can you push to a vector right after printing a reference to it, but not before? Why does let _ = guard release a lock immediately? Why does a closure that only reads a String still move it? These practice tests check how deeply you understand ownership, borrowing and the type system, one short program at a time.
What this practice test course offers:
- 200 original multiple-choice questions in 4 practice tests of 50, grouped by topic
- Short programs you must reason about: does it compile (and with which error), what does it print, or does it panic
- An explanation for every answer option, plus an overall explanation of the rule behind it
- Every program compiled and run with Rust 1.100 on the 2024 edition, so every answer matches what the real compiler does
- Current Rust: edition 2024 rules, let chains, if let guards, trait upcasting, async closures, get_disjoint_mut, extract_if and the never type
Topics covered:
- Ownership, moves, Copy and Clone, drop order and temporaries
- Borrowing, lifetimes, lifetime elision and the classic borrow checker errors
- Integer overflow and casts, enums, exhaustive matching, let-else and slice patterns
- Traits and generics, trait objects, dyn compatibility, the orphan rule and impl Trait capture rules
- Error handling with Option, Result and the question mark operator; collections, strings and iterators
- Box, Rc, Weak, Cell and RefCell, threads, Mutex, channels, async basics, unsafe, macros and modules
Who should take this course?
- Developers preparing for Rust interviews and coding assessments
- Programmers coming to Rust from C++, Go, Java or Python who want to master the borrow checker
- Rust developers moving their code to the 2024 edition who want to know what changed
If you have never written Rust, start with a Rust fundamentals course and come back here to test yourself.
How to use the tests: take one test at a time, then read every explanation, including the ones for questions you answered correctly. Retake a test a few days later to check that the rules have stuck.
This course is independent and is not affiliated with or endorsed by the Rust Foundation or the Rust Project.