๐Ÿงช Rust (programming language) MCQ Quiz Hub

Rust Programming Language (MCQ)

Choose a topic to test your knowledge and improve your Rust (programming language) skills

Which keyword is used to define a variable in Rust





โœ… Correct Answer: 2

Which of the following is immutable by default in Rust but can be made mutable





โœ… Correct Answer: 4

In OOP in Rust, which keyword is used to define Interfaces?





โœ… Correct Answer: 3

pub is used to define public in Rust. Are the data members in the structure public or private





โœ… Correct Answer: 1

What is the impl keyword used in Rust?





โœ… Correct Answer: 4

Which code statement in Rust is used to define a BTreeMap object?





โœ… Correct Answer: 1

Which command is used to compile a Rust code?





โœ… Correct Answer: 1

Among const and static in Rust, which one has low memory requirement?





โœ… Correct Answer: 4

Rust is known to be memory safe. Which feature is the main reason for the memory safety of Rust?>





โœ… Correct Answer: 1

Arbitrary casting is one of the most dangerous feature of Rust. Which keyword is used for it?





โœ… Correct Answer: 3

To support Dynamic Sized variables, what should we use in place of "f32"?





โœ… Correct Answer: 1

Raw pointers are unsafe pointers in Rust. What is the main use of Raw pointers in Rust?





โœ… Correct Answer: 4

In Rust, unsafe function and block allows 3 features. Which one feature is not allowed in Rust "unsafe" ?





โœ… Correct Answer: 3

What is the use of "type" keyword in Rust?





โœ… Correct Answer: 4

What is "Drop" in Rust used for?





โœ… Correct Answer: 4

In Rust, how is a macro from the above Rust code snippet used?





โœ… Correct Answer: 1

What is the predefined macro "unreachable!" in Rust used for?





โœ… Correct Answer: 4

Which library does Rust use for memory allocation?





โœ… Correct Answer: 2

Who designed Rust from scratch in 2006?





โœ… Correct Answer: 1

What is Cargo in Rust?





โœ… Correct Answer: 2

Does Rust guarantee Tail Call Optimization?





โœ… Correct Answer: 3

In a function declaration, we can use &self, self and &mul. When is self used?





โœ… Correct Answer: 1

When is unwrap() used in Rust?





โœ… Correct Answer: 4

What is the version of the latest Rust release (As of late 2021)?





โœ… Correct Answer: 3

Which company controls Rust Programming Language?





โœ… Correct Answer: 4

Is Rust an Object Oriented Programming (OOP) Language?





โœ… Correct Answer: 2

There are many string data types in Rust like Slice, OsStr, str, CStr, Owned, String, OsString and CString. Which one is a primitive data type in Rust?





โœ… Correct Answer: 3

Does Rust support "Move Constructors"





โœ… Correct Answer: 4

Is Rust Garbage Collected by default?





โœ… Correct Answer: 3

How to disable warnings in Rust about unused code segments?





โœ… Correct Answer: 2

How to print data type of a variable in Rust?





โœ… Correct Answer: 2

How to convert a String to an Integer (int) in Rust?





โœ… Correct Answer: 4

There are 3 different ways to return an iterator in Rust: into_itr, itr and itr_mul. What is the yield of the returned iterator for itr?





โœ… Correct Answer: 1

Rust supports many tools officially like Rustup and Rustfmt. What is Clippy tool in Rust?





โœ… Correct Answer: 2

What will be the output of the above Rust code?





โœ… Correct Answer: 1

The above code outputs the size of variable a. What is the output (in bytes)?





โœ… Correct Answer: 3

What is the output of the above code?





โœ… Correct Answer: 3

From previous question, we know increment and decrement operators does not exist in Rust. What will be the output of the above code?





โœ… Correct Answer: 1

Which function in Rust helps to clean heap memory?





โœ… Correct Answer: 4

From which code does the compilation of a Rust project begin





โœ… Correct Answer: 2

In a Rust code, what does & denote in a function signature?





โœ… Correct Answer: 2

In Rust, which keyword is used to define a boolean?





โœ… Correct Answer: 1

What bracket is used as a placeholder in Rust?





โœ… Correct Answer: 2

Which is the following is a correct Rust syntax?





โœ… Correct Answer: 1