Rust - Data Types Flashcards

1
Q

What typed language is rust

A

Statically typed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or false: The compiler can automatically infer data type of the variable based on the value assigned to it?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you declare a variable in rust

A

let first_name = “Prince”;
let do_i_like_rust = false;

println!(“{} does not like rust”, first_name);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A scalar type represents what type of value?

A

single

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Rust has how many scalar types?

A

4.
Integer
Floating-point
Booleans
Characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Mention the classifications of integers

A

Signed and unsigned.

Signed: i8,i16,i32,i64
Unsigned: u8, u16,u32,u64… usize

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Declare variable showing the use of unsigned and signed integers

A

let age: u32 = 19;
let sum: i32 = 5-15;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Classifications for float

A

f32 and f64.
Single and double precision

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True or false: Automatic type casting is allowed in rust?

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly