Rust MCQs with answers Page - 26

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which keyword is used to define an alias for a type?

  • (A) let
  • (B) alias
  • (C) define
  • (D) type

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which of the following is a primitive numeric type in Rust?

  • (A) float
  • (B) number
  • (C) f32
  • (D) decimal

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which keyword is used to define a generic function?

  • (A) fn<T>
  • (B) fn generic
  • (C) generic fn
  • (D) gen fn

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does unwrap_or_default() return when called on None?

  • (A) None
  • (B) Panic
  • (C) Default value of type
  • (D) 0

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which keyword is used to define a constant expression?

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

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which module provides environment variables?

  • (A) std::env
  • (B) std::os
  • (C) std::cfg
  • (D) std::path

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which keyword is used to define an asynchronous block of code?

  • (A) future
  • (B) await
  • (C) async
  • (D) task

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which standard library module is used to spawn threads?

  • (A) std::os
  • (B) std::thread
  • (C) std::env
  • (D) std::task

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does Arc<T> stand for?

  • (A) Array Counted
  • (B) Atomic Reference Counted
  • (C) Asynchronous Runtime Clone
  • (D) Aligned Recursive Container

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the output of the expression 5 / 2 in Rust?

  • (A) 2.5
  • (B) 2
  • (C) 3
  • (D) Compilation error

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