🧪 Rust (programming language) MCQ Quiz Hub

Rust Programming Language (MCQ)

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

1. Which keyword is used to define a variable in Rust




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




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




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




5. What is the impl keyword used in Rust?




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




7. Which command is used to compile a Rust code?




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




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




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




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




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




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




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




15. What is "Drop" in Rust used for?




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




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




18. Which library does Rust use for memory allocation?




19. Who designed Rust from scratch in 2006?




20. What is Cargo in Rust?




21. Does Rust guarantee Tail Call Optimization?




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




23. When is unwrap() used in Rust?




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




25. Which company controls Rust Programming Language?




26. Is Rust an Object Oriented Programming (OOP) Language?




27. 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?




28. Does Rust support "Move Constructors"




29. Is Rust Garbage Collected by default?




30. How to disable warnings in Rust about unused code segments?




31. How to print data type of a variable in Rust?




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




33. 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?




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




35. What will be the output of the above Rust code?




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




37. What is the output of the above code?




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




39. Which function in Rust helps to clean heap memory?




40. From which code does the compilation of a Rust project begin




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




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




43. What bracket is used as a placeholder in Rust?




44. Which is the following is a correct Rust syntax?