# 컬렉션 (Rust) > Vec, String, HashMap, HashSet, 이터레이터, collect, 컬렉션의 소유권 - 20 면접 질문 - Junior - [면접 질문: Rust](https://sharpskill.dev/ko/technologies/rust/interview-questions.md) ## 1. Vec의 끝에 요소를 추가할 수 있는 메서드는 무엇입니까? **답변** push() 메서드는 벡터의 끝에 요소를 추가하여 크기를 1만큼 늘립니다. 이 연산은 분할 상환 O(1) 복잡도를 가집니다. 용량을 초과하면 벡터가 메모리를 재할당해야 할 수 있기 때문입니다. 여러 요소를 추가하려면 필요에 따라 extend()나 append()를 사용할 수 있습니다. ## 2. Rust에서 String과 &str의 주요 차이점은 무엇입니까? **답변** String은 힙에 저장되는 소유(owned) 타입으로 가변적이며 크기 조정이 가능합니다. &str은 UTF-8 시퀀스에 대한 불변 참조로, 흔히 'string slice'라고 불립니다. String은 자신의 데이터를 소유하며 수정할 수 있는 반면, &str은 기존 데이터를 소유하지 않고 빌립니다. 이 구분은 Rust의 메모리 관리에서 핵심적입니다. ## 3. Rust에서 새로운 빈 Vec를 어떻게 생성합니까? **답변** Vec::new()는 초기 할당 없이 빈 벡터를 생성합니다. vec![] 매크로로도 빈 벡터를 생성할 수 있지만, Vec::new()가 표준적인 명시적 메서드입니다. 제네릭 타입은 추론되거나 turbofish 구문 Vec::::new() 또는 타입 어노테이션으로 명시적으로 지정할 수 있습니다. ## 17개 추가 질문 이용 가능 - Vec에서 get() 메서드는 무엇을 반환합니까? - 평균 O(1) 접근으로 키와 값을 연결하려면 어떤 데이터 구조를 사용해야 하나요? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Rust 면접 주제 - [Rust 기초](https://sharpskill.dev/ko/technologies/rust/interview-questions/rust-basics.md): 25개 질문, Junior - [Ownership & Borrowing](https://sharpskill.dev/ko/technologies/rust/interview-questions/ownership-borrowing.md): 22개 질문, Junior - [Structs & Enums](https://sharpskill.dev/ko/technologies/rust/interview-questions/structs-enums.md): 20개 질문, Junior - [에러 처리](https://sharpskill.dev/ko/technologies/rust/interview-questions/error-handling.md): 18개 질문, Junior - [모듈과 패키지](https://sharpskill.dev/ko/technologies/rust/interview-questions/modules-packages.md): 18개 질문, Junior - [Traits](https://sharpskill.dev/ko/technologies/rust/interview-questions/traits.md): 22개 질문, Mid-Level - [Generics](https://sharpskill.dev/ko/technologies/rust/interview-questions/generics.md): 20개 질문, Mid-Level - [Lifetimes](https://sharpskill.dev/ko/technologies/rust/interview-questions/lifetimes.md): 20개 질문, Mid-Level - [Iterators & Closures](https://sharpskill.dev/ko/technologies/rust/interview-questions/iterators-closures.md): 22개 질문, Mid-Level - [Smart Pointers](https://sharpskill.dev/ko/technologies/rust/interview-questions/smart-pointers.md): 22개 질문, Mid-Level - [Concurrency Basics](https://sharpskill.dev/ko/technologies/rust/interview-questions/concurrency-basics.md): 20개 질문, Mid-Level - [async/await](https://sharpskill.dev/ko/technologies/rust/interview-questions/async-await.md): 22개 질문, Mid-Level - [Testing](https://sharpskill.dev/ko/technologies/rust/interview-questions/testing.md): 18개 질문, Mid-Level - [Cargo & Ecosystem](https://sharpskill.dev/ko/technologies/rust/interview-questions/cargo-ecosystem.md): 18개 질문, Mid-Level - [Pattern Matching](https://sharpskill.dev/ko/technologies/rust/interview-questions/pattern-matching.md): 18개 질문, Mid-Level - [매크로](https://sharpskill.dev/ko/technologies/rust/interview-questions/macros.md): 20개 질문, Mid-Level - [Serde와 직렬화](https://sharpskill.dev/ko/technologies/rust/interview-questions/serde-serialization.md): 20개 질문, Mid-Level - [Unsafe Rust](https://sharpskill.dev/ko/technologies/rust/interview-questions/unsafe-rust.md): 20개 질문, Senior - [고급 트레잇](https://sharpskill.dev/ko/technologies/rust/interview-questions/advanced-traits.md): 22개 질문, Senior - [고급 lifetime](https://sharpskill.dev/ko/technologies/rust/interview-questions/advanced-lifetimes.md): 20개 질문, Senior - [Type System](https://sharpskill.dev/ko/technologies/rust/interview-questions/type-system.md): 20개 질문, Senior - [Tokio & Async I/O](https://sharpskill.dev/ko/technologies/rust/interview-questions/tokio-async.md): 22개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/rust/interview-questions/performance-optimization.md): 20개 질문, Senior - [Memory Management](https://sharpskill.dev/ko/technologies/rust/interview-questions/memory-management.md): 20개 질문, Senior - [Web Frameworks](https://sharpskill.dev/ko/technologies/rust/interview-questions/web-frameworks.md): 22개 질문, Senior - [Database Integration](https://sharpskill.dev/ko/technologies/rust/interview-questions/database-integration.md): 20개 질문, Senior - [Rust 디자인 패턴](https://sharpskill.dev/ko/technologies/rust/interview-questions/design-patterns.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/rust/interview-questions/collections