# C# 기초 (.NET) > 변수와 상수, 기본 타입, control flow, 클래스, struct, interface, 예외 - 25 면접 질문 - Junior - [면접 질문: .NET](https://sharpskill.dev/ko/technologies/dotnet/interview-questions.md) ## 1. C#에서 변수란 무엇인가요? **답변** 변수는 프로그램 실행 중에 변경할 수 있는 값을 담는, 메모리상의 이름이 붙은 저장 공간입니다. 각 변수에는 타입이 있어, 어떤 값을 담을 수 있는지와 어떤 연산이 허용되는지를 결정합니다. 명시적인 타입으로 변수를 선언하면 컴파일러가 코드의 일관성을 검증하고 메모리 사용을 최적화할 수 있습니다. ## 2. C#에서 변수와 상수의 차이는 무엇인가요? **답변** 변수는 초기화 후에 값을 변경할 수 있지만, 상수는 컴파일 시 값을 받아 프로그램의 수명 전체에 걸쳐 고정된 채로 유지됩니다. 상수는 const 키워드로 선언하며, 컴파일 시점에 알려진 값으로 초기화해야 합니다. 불변 값에 상수를 사용하면 가독성이 향상되고 컴파일러 최적화가 가능해집니다. ## 3. C#에서 단순한 정수를 저장하기에 적절한 타입은 무엇인가요? **답변** int 타입은 정수를 저장하기 위해 C#에서 가장 일반적으로 사용되는 정수 타입입니다. 메모리에서 32비트를 차지하며 약 -20억에서 +20억까지의 값을 담을 수 있습니다. 카운터, 인덱스, 수량과 관련된 대부분의 사용 사례에서 int는 값의 범위와 성능 사이에서 좋은 균형을 제공합니다. ## 22개 추가 질문 이용 가능 - C#에서 참/거짓 값을 저장하려면 어떤 타입을 사용해야 하나요? - C#에서 상수를 선언하는 올바른 구문은 무엇인가요? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 .NET 면접 주제 - [LINQ & Delegates](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-linq-delegates.md): 20개 질문, Junior - [C# 언어 핵심 요소](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-language-essentials.md): 15개 질문, Junior - [ASP.NET Core 기초](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/aspnet-core-fundamentals.md): 18개 질문, Junior - [ASP.NET Core 요청 수명 주기](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/aspnet-core-request-lifecycle.md): 20개 질문, Junior - [Configuration & Settings](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/configuration-settings.md): 20개 질문, Junior - [애플리케이션 라이프사이클](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/application-lifecycle.md): 20개 질문, Junior - [Dependency Injection](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/dependency-injection.md): 24개 질문, Mid-Level - [Entity Framework Core](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/entity-framework-core.md): 25개 질문, Mid-Level - [Minimal APIs](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/minimal-apis.md): 18개 질문, Mid-Level - [Web API 개발](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/web-api-development.md): 22개 질문, Mid-Level - [ASP.NET Core의 Async](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/async-aspnet-core.md): 20개 질문, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/authentication-authorization.md): 18개 질문, Mid-Level - [HttpClient & 네트워킹](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/httpclient-networking.md): 20개 질문, Mid-Level - [JSON 직렬화](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/json-serialization.md): 20개 질문, Mid-Level - [Entity Framework Core 고급](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/ef-core-advanced.md): 25개 질문, Mid-Level - [C# 고급 기능](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-advanced-features.md): 20개 질문, Mid-Level - [Clean Architecture](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/clean-architecture.md): 20개 질문, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/logging-monitoring.md): 22개 질문, Mid-Level - [단위 테스트와 xUnit](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/unit-testing-xunit.md): 20개 질문, Mid-Level - [통합 테스트](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/integration-testing.md): 18개 질문, Mid-Level - [Docker & Containerization](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/docker-containerization.md): 16개 질문, Mid-Level - [NuGet 패키지 관리](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/nuget-package-management.md): 16개 질문, Mid-Level - [Memory Management & GC](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/memory-management-gc.md): 22개 질문, Senior - [리액티브 프로그래밍](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/reactive-programming.md): 24개 질문, Senior - [Async/await 및 패턴](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/async-await-patterns.md): 26개 질문, Senior - [.NET 디자인 패턴](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/dotnet-design-patterns.md): 24개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/performance-optimization.md): 22개 질문, Senior - [보안 및 모범 사례](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/security-best-practices.md): 24개 질문, Senior - [SignalR 및 실시간](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/signalr-realtime.md): 22개 질문, Senior - [마이크로서비스 아키텍처](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/microservices-architecture.md): 25개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-basics