Lifetimes interview questions

15 real Lifetimes questions from the Rust bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is Lifetime?

Mid
  1. A.a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
  2. B.a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  3. C.the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  4. D.the special region spanning the entire program duration, required for references such as string literals baked into the binary
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Mid
  1. A.Lifetime — explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.Lifetime — the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  3. C.Lifetime — a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  4. D.Lifetime — a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
Reveal the answer + AI explanation — free account

4. What is Dangling reference?

Mid
  1. A.explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.the special region spanning the entire program duration, required for references such as string literals baked into the binary
  3. C.a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  4. D.a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. A.Dangling reference — explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.Dangling reference — a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  3. C.Dangling reference — the special region spanning the entire program duration, required for references such as string literals baked into the binary
  4. D.Dangling reference — the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
Reveal the answer + AI explanation — free account

7. What is 'static?

Mid
  1. A.the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  2. B.a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  3. C.a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
  4. D.the special region spanning the entire program duration, required for references such as string literals baked into the binary
Reveal the answer + AI explanation — free account

8. Which term means: "the special region spanning the entire program duration, required for references such as string literals baked into the binary"?

Mid
  1. A.Dangling reference
  2. B.Lifetime
  3. C.'static
  4. D.Lifetime annotation
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.'static — the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  2. B.'static — a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
  3. C.'static — a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  4. D.'static — the special region spanning the entire program duration, required for references such as string literals baked into the binary
Reveal the answer + AI explanation — free account

10. What is Lifetime elision?

Senior
  1. A.explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  3. C.a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  4. D.a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
Reveal the answer + AI explanation — free account

11. Which term means: "the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly"?

Senior
  1. A.Lifetime
  2. B.Lifetime elision
  3. C.'static
  4. D.Dangling reference
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Senior
  1. A.Lifetime elision — explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.Lifetime elision — the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
  3. C.Lifetime elision — a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
  4. D.Lifetime elision — the special region spanning the entire program duration, required for references such as string literals baked into the binary
Reveal the answer + AI explanation — free account

13. What is Lifetime annotation?

Senior
  1. A.a pointer that outlives the data it points to, a bug the compiler statically prevents by rejecting the borrow
  2. B.explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  3. C.the special region spanning the entire program duration, required for references such as string literals baked into the binary
  4. D.the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
Reveal the answer + AI explanation — free account

14. Which term means: "explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source"?

Senior
  1. A.Lifetime annotation
  2. B.'static
  3. C.Lifetime elision
  4. D.Lifetime
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.Lifetime annotation — explicit syntax relating the validity regions of input and output references so the compiler can verify none outlives its source
  2. B.Lifetime annotation — the special region spanning the entire program duration, required for references such as string literals baked into the binary
  3. C.Lifetime annotation — a named region of code, written with a leading apostrophe, over which a reference is guaranteed to remain valid
  4. D.Lifetime annotation — the set of compiler rules that infer the durations of references in common function signatures so they need not be written explicitly
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Lifetimes free