This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Answer the following questions to demonstrate what you've learned:
Which of the following attempts will not cause a Rust program to panic?
Accessing an out-of-bounds index of a vector with vector[index] notation.
vector[index]
Accessing an out-of-bounds index of a vector with vector.get(index) notation.
vector.get(index)
Accessing an out-of-bounds index of an array with array[index] notation.
array[index]
Accessing a non-existent key of a hash map with HashMap[key] notation.
HashMap[key]
How can you represent the possibility of absence of a value of a given type, T, in Rust?
T
The Option<T> type.
Option<T>
The Result<T, bool> type.
Result<T, bool>
A false value of the bool type.
false
bool
An empty tuple: ().
()
How can you represent the possibility of input/output (I/O) failure when you're obtaining a value of a given type, T?
The Result<T, io::Error> type.
Result<T, io::Error>
An empty Vec<T>.
Vec<T>
You must answer all questions before checking your work.
Continue
Was this page helpful?