Skip to content

Project exam · Rust Programming

Project exam: Rust in practice

Project examexpert· about 2 hours· 9 steps· 120 min · pass 70%

The brief

A timed, hands-on exam over the whole course. In two hours you write nine small Rust programs in one cargo project: variables and constants, input with slab logic, fixing borrow-checker errors, structs and enums, Result with a custom error, a HashMap tally, threads with a channel, unit tests, and a clean clippy and rustfmt run. For each task you paste the output of a command; no hints or answers are shown until you hand it in.

Why it matters

Rust interviews and take-home tests are practical: you get a short time to make code compile, behave correctly and pass the linters. Working against the clock, without looking things up, shows you which parts of the language you really own and which need another pass before you apply.

Skills you practise

  • let, mut, const and shadowing
  • stdin, parse and match
  • fixing E0502 and E0507
  • struct, enum and match
  • Result, ? and a custom error with Display
  • HashMap and sorting
  • threads and mpsc channels
  • #[test] and cargo test
  • cargo clippy and cargo fmt

You need

  • Rust stable installed with rustup, with clippy and rustfmt
  • A terminal and an editor; two hours without interruptions
  • Create the project before you start the timer: cargo new rust_exam

What you will have at the end

The rust_exam cargo project with nine finished tasks (src/bin/task1.rs to task7.rs, src/lib.rs with tests), clean under rustfmt and clippy, and your marked results.

How it is marked (rubric, 100 points)
Programs give the right outputTasks 1 to 7 print exactly the required lines.55
TestsTask 8 has at least three meaningful passing tests, including the short-payment case.15
Clean codeTask 9: formatted and clippy-clean with -D warnings.15
Idiomatic choicesBorrow errors fixed properly (no needless clones), errors handled with Result, threads joined or the channel closed correctly.15
  • 9tasks
  • 120 mintime limit
  • 70%to pass

Rules: a project exam

  • Do each task on your own machine, then paste the command output into its box here.
  • Work alone, without notes or a search engine, as in the real exam.
  • No hints and no answers. You can run your code, but the checks run only when you hand in.
  • Every task is checked automatically when you hand in, or when the time is up.
  • You see which tasks passed at the end. You can take it again.
Not yet, go back