Rust MCQs with answers Page - 4

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 • 832.01K Points
Coach

Q. What does `derive(Debug)` allow you to do?

  • (A) Add debugging breakpoints
  • (B) Enable println! for the struct
  • (C) Print struct using {:?}
  • (D) Add logging

A

Admin • 832.01K Points
Coach

Q. Which of the following correctly clones a vector?

  • (A) vec.clone()
  • (B) vec.copy()
  • (C) vec.duplicate()
  • (D) vec.replicate()

A

Admin • 832.01K Points
Coach

Q. What is a tuple in Rust?

  • (A) A type that holds only strings
  • (B) A fixed-size collection of values of different types
  • (C) A mutable array
  • (D) A recursive data structure

A

Admin • 832.01K Points
Coach

Q. Which keyword is used for error handling in Rust?

  • (A) throw
  • (B) catch
  • (C) try
  • (D) match

A

Admin • 832.01K Points
Coach

Q. What does `cargo run` do?

  • (A) Compiles and runs the Rust program
  • (B) Installs dependencies
  • (C) Formats the code
  • (D) Runs tests only

A

Admin • 832.01K Points
Coach

Q. What is the output of `3 / 2` in Rust (using integer types)?

  • (A) 1.5
  • (B) 2
  • (C) 1
  • (D) 3

A

Admin • 832.01K Points
Coach

Q. Which type is used to represent true or false in Rust?

  • (A) boolean
  • (B) bool
  • (C) bit
  • (D) flag

A

Admin • 832.01K Points
Coach

Q. What does the `as` keyword do in Rust?

  • (A) Checks types
  • (B) Performs safe type casting
  • (C) Declares a variable
  • (D) Implements traits

A

Admin • 832.01K Points
Coach

Q. Which of these is used for creating a new thread in Rust?

  • (A) std::thread::create
  • (B) thread::build
  • (C) std::thread::spawn
  • (D) core::thread::start

A

Admin • 832.01K Points
Coach

Q. Which crate provides asynchronous programming features in Rust?

  • (A) async
  • (B) threading
  • (C) futures
  • (D) serde

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