Rust is a systems programming language known for its focus on safety, performance, and concurrency. It’s designed to prevent memory errors and data races while providing low-level control. This set of 30 multiple-choice questions covers Rust’s basic concepts, installation, environment setup, writing the first program, and using the Rust compiler.
unsafe keywordResult type for explicit error handlingmutletconstvarcargorustuprustcbrewrust --versioncargo commandrustup tool in Rust development?
rustup via curlrustup-init scriptrustup?
rustup installrustup-init.execargo installrustc installrustup install along with Rust itself?
cargo)rustup installerrustup updatecargo updaterustc --updaterustup upgradecargo installrustup component addrustc component addcargo updatebrewrustupcargoRust AnalyzerCargo HelperRustfmtRust Lintercargo?
cargo initcargo newrust newcargo startsrc/main.rsbin/rust_code.rslib/rust_code.rssrc/main.ccargo buildrustc buildcargo compilerustc compilecargo run command do?
cargo to manage dependencies in a Rust project?
Cargo.tomlbuild.rsCargo.lockRustfileCargo.tomlrustup?
cargo tool in Rust development?
| Qno | Answer |
|---|---|
| 1 | A) Memory safety without a garbage collector |
| 2 | B) It enforces strict memory management to avoid data races |
| 3 | B) Systems programming language |
| 4 | C) Data races and mutable aliasing |
| 5 | B) Ownership and borrowing |
| 6 | A) Simplified memory management |
| 7 | B) Operating systems and embedded systems |
| 8 | B) It uses a Result type for explicit error handling |
| 9 | B) let |
| 10 | A) C++ |
| 11 | B) rustup |
| 12 | A) By checking the Rust version with rust --version |
| 13 | B) To manage Rust toolchains and versions |
| 14 | D) Install a Rust IDE like Visual Studio Code |
| 15 | B) rustup-init.exe |
| 16 | B) To manage Rust toolchains and versions |
| 17 | C) Running the rustup installer |
| 18 | A) rustup update |
| 19 | B) rustup component add |
| 20 | B) Using rustup |
| 21 | A) Visual Studio Code |
| 22 | A) Rust Analyzer |
| 23 | B) cargo new |
| 24 | A) src/main.rs |
| 25 | A) cargo build |
| 26 | A) Builds the Rust project and runs it |
| 27 | A) Cargo.toml |
| 28 | A) Manually managing versions in Cargo.toml |
| 29 | B) The latest stable version |
| 30 | B) To manage Rust dependencies and build projects |