Traits interview questions

18 real Traits 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 Trait?

Junior
  1. A.a named collection of method signatures defining shared behavior that types can implement
  2. B.a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  3. C.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  4. D.a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.Trait — a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  2. B.Trait — the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  3. C.Trait — a named collection of method signatures defining shared behavior that types can implement
  4. D.Trait — a body provided inside a trait definition that implementors inherit unless they choose to override it
Reveal the answer + AI explanation — free account

4. What is Trait bound?

Mid
  1. A.a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  2. B.a constraint on a generic parameter requiring it to implement specified behavior before the code will compile
  3. C.a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  4. D.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. A.Trait bound — a body provided inside a trait definition that implementors inherit unless they choose to override it
  2. B.Trait bound — a constraint on a generic parameter requiring it to implement specified behavior before the code will compile
  3. C.Trait bound — a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  4. D.Trait bound — a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
Reveal the answer + AI explanation — free account

7. What is Default method?

Mid
  1. A.a named collection of method signatures defining shared behavior that types can implement
  2. B.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  3. C.a body provided inside a trait definition that implementors inherit unless they choose to override it
  4. D.a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.Default method — a named collection of method signatures defining shared behavior that types can implement
  2. B.Default method — a body provided inside a trait definition that implementors inherit unless they choose to override it
  3. C.Default method — a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  4. D.Default method — the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
Reveal the answer + AI explanation — free account

10. What is Trait object?

Senior
  1. A.a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  2. B.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  3. C.a body provided inside a trait definition that implementors inherit unless they choose to override it
  4. D.a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
Reveal the answer + AI explanation — free account

11. Which term means: "a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable"?

Senior
  1. A.Default method
  2. B.Trait object
  3. C.Orphan rule
  4. D.Trait
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Senior
  1. A.Trait object — a constraint on a generic parameter requiring it to implement specified behavior before the code will compile
  2. B.Trait object — a body provided inside a trait definition that implementors inherit unless they choose to override it
  3. C.Trait object — a value behind a pointer annotated with dyn that enables dynamic dispatch over any type implementing the behavior, resolved at runtime via a vtable
  4. D.Trait object — a named collection of method signatures defining shared behavior that types can implement
Reveal the answer + AI explanation — free account

13. What is impl Trait?

Senior
  1. A.a named collection of method signatures defining shared behavior that types can implement
  2. B.a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  3. C.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  4. D.a constraint on a generic parameter requiring it to implement specified behavior before the code will compile
Reveal the answer + AI explanation — free account

14. Which term means: "a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable"?

Senior
  1. A.Trait bound
  2. B.impl Trait
  3. C.Default method
  4. D.Trait
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.impl Trait — the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  2. B.impl Trait — a body provided inside a trait definition that implementors inherit unless they choose to override it
  3. C.impl Trait — a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  4. D.impl Trait — a named collection of method signatures defining shared behavior that types can implement
Reveal the answer + AI explanation — free account

16. What is Orphan rule?

Senior
  1. A.a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  2. B.a named collection of method signatures defining shared behavior that types can implement
  3. C.the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
  4. D.a body provided inside a trait definition that implementors inherit unless they choose to override it
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Senior
  1. A.Orphan rule — a constraint on a generic parameter requiring it to implement specified behavior before the code will compile
  2. B.Orphan rule — a syntax in argument or return position denoting some single concrete type implementing the given behavior, resolved statically without a vtable
  3. C.Orphan rule — a body provided inside a trait definition that implementors inherit unless they choose to override it
  4. D.Orphan rule — the coherence restriction forbidding an implementation unless either the trait or the type is local to the current crate
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 Traits free