WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Rust · Basic · question 4 of 100

What are Rust’s primitive data types?

📕 Buy this interview preparation book: 100 Rust questions & answers — PDF + EPUB for $5

Rust has several primitive data types, which are the fundamental building blocks for more complex data structures. Here are the most commonly used primitive data types in Rust:

Integer types:

The numbers in these type names represent the number of bits used to store the value. Signed integers can store both positive and negative values, while unsigned integers can only store non-negative values.

Floating-point types:

Boolean type: bool: A type representing true or false values.

Character type: char: A 32-bit Unicode scalar value representing a single Unicode character.

Tuple type:

Tuples are fixed-size collections of values, where each value can have a different type. They are denoted using parentheses () and comma-separated values. For example, (i32, f64, bool) is a tuple type containing an i32, an f64, and a bool.

Array type:

Arrays are fixed-size collections of values with the same type. They are denoted using square brackets [] and a semicolon ; to separate the length from the element type. For example, [i32; 5] is an array type containing 5 elements of type i32.

Slice type:

Slices are similar to arrays but with a dynamically-sized length. They are denoted using the & symbol and square brackets []. For example, &[i32] is a slice type containing elements of type i32.

Reference type:

References are pointers to a value of a particular data type. They are denoted using the & symbol followed by the data type. For example, &i32 is a reference to a value of type i32.

These primitive data types are the foundation for building more complex data structures in Rust, and they can be combined in various ways to express more complicated data and behavior.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Rust interview — then scores it.
📞 Practice Rust — free 15 min
📕 Buy this interview preparation book: 100 Rust questions & answers — PDF + EPUB for $5

All 100 Rust questions · All topics