Recall & Review
beginner
What does the '+' operator do in Rust?
The '+' operator adds two numbers together. For example, 2 + 3 equals 5.
Click to reveal answer
beginner
How do you perform multiplication in Rust?
Use the '*' operator to multiply two numbers. For example, 4 * 5 equals 20.
Click to reveal answer
intermediate
What is the result of 10 / 3 in Rust when using integer types?
When dividing integers, Rust performs integer division, so 10 / 3 equals 3 (the decimal part is dropped).
Click to reveal answer
beginner
What does the '%' operator do in Rust?
The '%' operator gives the remainder of a division. For example, 10 % 3 equals 1.
Click to reveal answer
intermediate
Can you use arithmetic operators with floating-point numbers in Rust?
Yes, you can use '+', '-', '*', and '/' with floating-point numbers (like f32 or f64). The operations work as expected with decimals. The '%' operator is not supported for floating-point types in Rust.
Click to reveal answer
What is the result of 7 + 5 in Rust?
✗ Incorrect
The '+' operator adds numbers, so 7 + 5 equals 12.
Which operator gives the remainder of a division?
✗ Incorrect
The '%' operator returns the remainder after division.
What happens when you divide two integers in Rust and the result is not whole?
✗ Incorrect
Integer division drops the decimal part, so 10 / 3 equals 3.
Which operator is used for multiplication in Rust?
✗ Incorrect
The '*' operator multiplies two numbers.
Can you use the '+' operator with floating-point numbers in Rust?
✗ Incorrect
The '+' operator works with floating-point numbers as well as integers.
Explain how the '%' operator works in Rust and give an example.
Think about what is left after dividing one number by another.
You got /3 concepts.
Describe what happens when you divide two integers in Rust and the result is not a whole number.
Rust does not round but cuts off the decimal.
You got /3 concepts.