Basics Flashcards

simple basics

1
Q

what is the syntax for initializing a variable name x that is a 32 bit signed integer to the value -1?

A

let x: i32 = -1;

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

Is Rust a statically typed language?

A

yes

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

Is there a boolean type, what is it called and what are the values it can be

A

bool, true, false

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

rust character type, which coding is it ascii, unicode, utf-8?

A

char type, utf-8

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

what is the syntax for a Rust tuple

A

(“Ian”, 18)

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

What is the syntax for creating a reference called ref to a value called a ?

A

let ref = &a;

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

are variables mutable by default?

A

no

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

what is the syntax for declaring a mutable integer

A

let mut x = 4;

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

what is the basic “hello World” program

A
fn main(){
println!("Hello World");
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

snake_case is used by convention for which type names?

A

crates, modules, functions, methods

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

CamelCase is used by convention for which type names.

A

Types, traits, and enums

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
what is wrong with the following function? 
fn FnameBlaster ( val, u32) {
A

function name is not snake_case

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