Rust Intermediate Quiz
Explore structs, enums, traits, error handling, collections, and pattern matching
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. What is a struct?
- Custom data type grouping related values
- Record
- Class
- Object
Show answer
Answer: Custom data type grouping related values. Struct groups related data: struct User { name: String, age: u32 }. Create: User { name: String::from("John"), age: 30 }. Three types: classic, tuple, unit.
2. What are the three types of structs?
- Classic (named fields), tuple, unit
- Public, private, protected
- Value, reference
- Mutable, immutable
Show answer
Answer: Classic (named fields), tuple, unit. Struct types: classic (struct Point { x: i32, y: i32 }), tuple (struct Color(i32, i32, i32)), unit (struct Marker;). Choose based on use case.
3. What is an enum?
- Options list
- Choice type
- Type with multiple possible variants
- Enumeration
Show answer
Answer: Type with multiple possible variants. Enum defines variants: enum Message { Quit, Move { x: i32, y: i32 }, Write(String) }. Each variant can hold different data. More powerful than C enums.
Frequently asked questions
How many questions are in this Rust quiz?+
30 questions, with a 60-minute time limit. Every question includes a written explanation of the correct answer.
Is this Rust quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the intermediate quiz aimed at?+
Explore structs, enums, traits, error handling, collections, and pattern matching
Can I use this to prepare for a Rust interview?+
Yes. The questions cover the topics that come up in Rust technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your Rust?
30 questions, 60 minutes. Free, no sign-up.
Start now