Rust

Rust Basics

Variables, mutability, primitive types, functions, expressions, control flow, pattern matching

25 면접 질문·
Junior
1

By default, how are variables declared in Rust?

답변

In Rust, all variables are immutable by default when declared with let. This design promotes safety and concurrency by preventing accidental modifications. To make a variable mutable, explicitly use the mut keyword after let.

2

What is the difference between let and const in Rust?

답변

const declares a compile-time constant with mandatory type annotation, while let declares a runtime variable with possible type inference. Constants must have values known at compile time and can be used in compilation contexts like array sizes.

3

What is shadowing in Rust?

답변

Shadowing allows redeclaring a variable with the same name using let, creating a new variable that hides the previous one. Unlike mut, shadowing allows changing the variable type. This is useful for transforming a value while keeping the same logical name.

4

What is the default signed integer type in Rust?

5

What is the difference between isize and i64 in Rust?

+22 면접 질문

다음 면접을 위해 Rust을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기