Rust MCQs with answers Page - 11

Here, you will find a collection of MCQ questions on Rust. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Which type provides atomic reference counting in Rust?

  • (A) Rc<T>
  • (B) RefCell<T>
  • (C) Arc<T>
  • (D) Box<T>

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to declare constants in Rust?

  • (A) static
  • (B) const
  • (C) define
  • (D) final

A

Admin • 833.24K Points
Coach

Q. Which trait is required for formatted output using `{}`?

  • (A) Debug
  • (B) Display
  • (C) Clone
  • (D) Copy

A

Admin • 833.24K Points
Coach

Q. Which of these is a valid way to declare a mutable variable?

  • (A) let x = mut 5;
  • (B) mut let x = 5;
  • (C) let mut x = 5;
  • (D) let x mut = 5;

A

Admin • 833.24K Points
Coach

Q. What does `.collect()` do on an iterator?

  • (A) Prints all items
  • (B) Sums all items
  • (C) Returns a new collection from iterator items
  • (D) Sorts all items

A

Admin • 833.24K Points
Coach

Q. Which trait is used for operator overloading of `==`?

  • (A) Eq
  • (B) Ord
  • (C) PartialEq
  • (D) Compare

A

Admin • 833.24K Points
Coach

Q. Which lifetime specifier denotes the entire program duration?

  • (A) 'self
  • (B) 'prog
  • (C) 'perm
  • (D) 'static

A

Admin • 833.24K Points
Coach

Q. Which macro prints to standard error in Rust?

  • (A) print!
  • (B) eprint!
  • (C) println!
  • (D) stderr!

A

Admin • 833.24K Points
Coach

Q. What is the default trait bound for generic types in Rust?

  • (A) Sized
  • (B) Copy
  • (C) Clone
  • (D) Display

A

Admin • 833.24K Points
Coach

Q. Which standard library module deals with concurrency?

  • (A) std::cmp
  • (B) std::sync
  • (C) std::fmt
  • (D) std::ops

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ