Build reasoning skills in Rust ownership, borrowing, enums, error handling, traits and safe concurrency.
Four self-study difficulty levels, from basic concepts to advanced scenarios. Difficulty is an editorial guide, not an official certification ranking. Safe Rust concepts unless a question explicitly discusses unsafe code. No claim of formal verification or official certification.
YOUR PRACTICE SPACE
Learn it. Test it. Understand it.
Recognize core concepts and trace a single step.
10 questions in Easy · one answer per question · no timer
Free, no account needed. Answers stay in this tab and reset on reload. This is self-study, not a proctored exam or certificate.
Choose the right challenge
Easy checks core concepts. Medium applies them to tasks. Hard examines edge cases and failure modes. Very advanced combines constraints such as concurrency, security and recovery. Start where you are comfortable; each level has its own attempt and result. These labels are editorial, not certification grades.
What you will learn
Trace ownership and borrowing through function calls.
Model optional values and recoverable errors explicitly.
Choose appropriate sharing and synchronization types.
Think through a real scenario
A function tries to return a reference to a String created inside that function. The String is destroyed when its owner leaves scope, so returning the reference would leave a dangling borrow. Return an owned String or borrow suitable caller-owned data instead. Adding a lifetime annotation does not extend the local value’s lifetime.
Turn your result into a study plan
For each missed question, write down the rule you overlooked and test it with a small example. Avoid memorizing an option’s position: understanding the behavior matters more than recognizing the wording. In exam mode explanations stay hidden until you submit; in practice mode use “Check answer” to see feedback immediately.
Read further
The questions and explanations are original EmuPath teaching material. These references provide background for further study; their publishers do not endorse this exam.
Found an ambiguous question? Include the track and question text in your correction report.
Sample Rust Programming questions with explanations
Preview one question from each difficulty level before choosing a practice session. These examples also appear in the question bank. Try answering first, then open the explanation to check your reasoning.
Easy: Bindings
What is the default mutability of a variable introduced with let in Rust?
Immutable unless declared mutable
Always mutable
Mutable only on Linux
Determined by the file name
Show answer and explanation
Immutable unless declared mutable
A plain let binding cannot be reassigned. Adding mut permits mutation where the type and borrowing rules allow it; shadowing is a separate mechanism.
Medium: Moves
After let b = a where a is a String, can a normally still be used?
No, ownership moved to b unless a copy was explicitly made
Yes, String is always implicitly deep-copied
Yes, assignment only borrows String
Only when b is shorter
Show answer and explanation
No, ownership moved to b unless a copy was explicitly made
String does not implement Copy. Moving it transfers ownership, so using the old binding is rejected unless the program follows a different ownership strategy.
Hard: Dangling borrows
Why is returning a reference to a function-local String rejected?
The local owner is destroyed before the caller can use the reference
References are forbidden as all return values
String cannot be created inside functions
Every return requires a clone
Show answer and explanation
The local owner is destroyed before the caller can use the reference
A reference must remain valid for its use by the caller. Return ownership or borrow data with a suitable external lifetime rather than referring to a destroyed local.
Very advanced: Shared mutation
Does wrapping a value in Arc alone make arbitrary mutation of that value safe across threads?
No; mutation still requires appropriate synchronization or a safe interior-mutable design
Yes, Arc locks every method automatically
Yes, provided the value is small
Only cloned Arc handles need locks
Show answer and explanation
No; mutation still requires appropriate synchronization or a safe interior-mutable design
Arc coordinates ownership counts, not arbitrary access to the contained state. A shared mutable design must satisfy the contained type’s thread-safety and synchronization requirements.