Rust Advanced Quiz
Master lifetimes, concurrency, unsafe code, macros, and advanced type system features
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 are lifetimes?
- Scope annotation
- Validity period
- Reference duration
- Ensure references valid as long as needed
Show answer
Answer: Ensure references valid as long as needed. Lifetimes ensure references remain valid. Prevent dangling references. Annotated: 'a. Compiler infers most. Explicit in function signatures, structs with references.
2. What is lifetime annotation?
- Lifetime declaration
- 'a syntax describing reference relationships
- Reference annotation
- Scope marker
Show answer
Answer: 'a syntax describing reference relationships. Lifetime annotation: fn function<'a>(x: &'a str, y: &'a str) -> &'a str. Doesn't change lifetimes, describes relationships. Compiler checks validity.
3. What is 'static lifetime?
- Global lifetime
- Infinite lifetime
- Lives for entire program duration
- Permanent reference
Show answer
Answer: Lives for entire program duration. 'static lives entire program. String literals have 'static. Use sparingly - often not needed. const and static items have 'static. Longest possible lifetime.
Frequently asked questions
How many questions are in this Rust quiz?+
30 questions, with a 75-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 advanced quiz aimed at?+
Master lifetimes, concurrency, unsafe code, macros, and advanced type system features
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, 75 minutes. Free, no sign-up.
Start now