Victor A

2 min read

Rust Test nr.1

CodingTestsrust

Rust Beginner's Test

Time Elapsed: 0 seconds

1. What is the output of the following code?

```rust fn main() { println!("{}", 5 + 3 * 2); } ```



2. Which keyword is used to define an immutable variable in Rust?





3. How do you declare a function in Rust?





4. What is the output of the following code?

```rust fn main() { let x = 5; let y = 10; println!("{}", x == y); } ```



5. How do you create a list in Python with the elements 1, 2, and 3?

6. Explain the difference between clone() and copy() in Rust.

7. Write a Rust expression to check if the string "hello" contains the substring "ell".

8. What is the purpose of the Option type in Rust?