πŸ§ͺ Rust (programming language) MCQ Quiz Hub

Rust Multiple Choice Questions

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

Who designed Rust?





βœ… Correct Answer: 3

Rust is syntatically similar to which programming language?





βœ… Correct Answer: 1

Which among the following is permitted by rust?





βœ… Correct Answer: 2

Which among the following is not a valid keyword in Rust?





βœ… Correct Answer: 4

Which keyword is used to write a function in rust?





βœ… Correct Answer: 1

What does ::new indicates?





βœ… Correct Answer: 1

What are the result types in Rust?





βœ… Correct Answer: 2

Which of the following are Result variants in Rust?





βœ… Correct Answer: 4

Which method is defined on Result types?





βœ… Correct Answer: 2

Which brackets are used as placeholder in rust?





βœ… Correct Answer: 1

Constants cant be defined in which scope





βœ… Correct Answer: 4

Rust is





βœ… Correct Answer: 1

Choose the correct scalar types in Rust





βœ… Correct Answer: 2

Which keyword is used to specify Boolean type?





βœ… Correct Answer: 3

Which are the two primitive compound types supported by Rust?





βœ… Correct Answer: 1

Which of the following is false with respect to tuples?





βœ… Correct Answer: 4

Which is not a valid declaration of an array?





βœ… Correct Answer: 3

Which symbol is used to declare the functions with return values?





βœ… Correct Answer: 4

What is the output of the following program snippet: fn main() { let three = 3; if three { println!("number was three"); } }





βœ… Correct Answer: 3

Which among the following loop is not supported by Rust?





βœ… Correct Answer: 4

Which among the following is false with respect to ownership rules?





βœ… Correct Answer: 4

Which operator allows to use namespace?





βœ… Correct Answer: 1

What does the String data type hold in Rust?





βœ… Correct Answer: 2

What does the below statements infer? let s1 = String::from("example"); let s2 = s1;





βœ… Correct Answer: 3

Which function assists in cleaning up the heap memory in Rust?





βœ… Correct Answer: 1

Automatic copying in rust ______





βœ… Correct Answer: 1

Identify the types which are not Copy in Rust?





βœ… Correct Answer: 4

What does & in the function signature of Rust indicate?





βœ… Correct Answer: 1

When does the data race occur in Rust?





βœ… Correct Answer: 4

Which among the following is not a valid rule for references in Rust?





βœ… Correct Answer: 4

What is the proper notation of Rust's range syntax?





βœ… Correct Answer: 1

String literals are





βœ… Correct Answer: 4

Which is not true with respect to structs in Rust?





βœ… Correct Answer: 2

In Tuple structs





βœ… Correct Answer: 1

What is the use of unit-like structs?





βœ… Correct Answer: 4

Which keyword is used to create a method?





βœ… Correct Answer: 1

What are associated functions?





βœ… Correct Answer: 3

Which among the following is true with respect to Multiple impl blocks?





βœ… Correct Answer: 3

Choose the valid variant of enum in Rust?





βœ… Correct Answer: 4

Which among the following is false with respect to Option Enum in Rust?





βœ… Correct Answer: 4

Which is the control flow operator used for pattern matching in Rust?





βœ… Correct Answer: 2

Which operator separates the pattern and the code to be executed?





βœ… Correct Answer: 1

Which operator is used as placeholder in Rust for pattern matching?





βœ… Correct Answer: 4

Which among the following is not true regarding if let in Rust?





βœ… Correct Answer: 3

Which standard library type helps to use the type system in order to prevent errors in Rust?





βœ… Correct Answer: 1

Which Cargo feature helps to build, test, and share crates?





βœ… Correct Answer: 2

Which among the following has a tree of modules that produces a library or executable?





βœ… Correct Answer: 2

Which helps in controlling the organization, scope and Paths privacy?





βœ… Correct Answer: 3

What is a way of naming an item, such as a struct, function, or module called?





βœ… Correct Answer: 4

From which source file does the Rust compiler start?





βœ… Correct Answer: 1