Rust MCQs with answers Page - 34

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

Q. What is the output of this code?

Code:
fn main() {
    let x = 10;
    let y = &x;
    println!("{}", y);
}
  • (A) 10
  • (B) &10
  • (C) Compilation error
  • (D) Memory address

A

Admin • 802.91K Points
Coach

Q. Which of the following is true about Rust's memory management?

  • (A) Uses garbage collection
  • (B) Manual memory allocation
  • (C) Ownership and borrowing
  • (D) Reference counting only

A

Admin • 802.91K Points
Coach

Q. What is the output of this code?

Code:
fn main() {
    let mut x = 5;
    x += 1;
    println!("{}", x);
}
  • (A) 5
  • (B) 6
  • (C) Compilation error
  • (D) Undefined

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