Quiz: Types and Memory Management
Test yourself on what you have learned so far in this chapter.
1
What is the output of the following code snippet?
fn main() {
let word: &str = "Hello";
let mut word_string: String = word.to_string();
word_string.push('o');
word_string.pop();
word_string.push('!');
println!("{}", word_string);
}
A)
Helloo!
B)
Hello
C)
Hello!
D)
The code will result in an error.
Question 1 of 50 attempted
Get hands-on with 1400+ tech skills courses.