# C# Basics (.NET) > Variables & constants, primitive types, control flow, classes, structs, interfaces, exceptions - 25 interview questions - Junior - [Interview Questions: .NET](https://sharpskill.dev/en/technologies/dotnet/interview-questions.md) ## 1. What is a variable in C#? **Answer** A variable is a named storage location in memory that holds a value which can be modified during program execution. Each variable has a type that determines what values it can contain and what operations are allowed. Declaring a variable with an explicit type allows the compiler to verify code consistency and optimize memory usage. ## 2. What is the difference between a variable and a constant in C#? **Answer** A variable can have its value changed after initialization, whereas a constant receives a value at compilation that remains fixed throughout the program's lifetime. Constants are declared with the const keyword and must be initialized with a compile-time known value. Using constants for immutable values improves readability and enables compiler optimizations. ## 3. What is the appropriate type to store a simple integer in C#? **Answer** The int type is the most commonly used integer type in C# for storing whole numbers. It occupies 32 bits in memory and can hold values ranging from approximately -2 billion to +2 billion. For most use cases involving counters, indices, or quantities, int provides a good balance between value range and performance. ## 22 more questions available - What type should be used to store a true/false value in C#? - What is the correct syntax to declare a constant in C#? Sign up for free: https://sharpskill.dev/en/login ## Other .NET interview topics - [LINQ & Delegates](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-linq-delegates.md): 20 questions, Junior - [C# Language Essentials](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-language-essentials.md): 15 questions, Junior - [ASP.NET Core Fundamentals](https://sharpskill.dev/en/technologies/dotnet/interview-questions/aspnet-core-fundamentals.md): 18 questions, Junior - [ASP.NET Core Request Lifecycle](https://sharpskill.dev/en/technologies/dotnet/interview-questions/aspnet-core-request-lifecycle.md): 20 questions, Junior - [Configuration & Settings](https://sharpskill.dev/en/technologies/dotnet/interview-questions/configuration-settings.md): 20 questions, Junior - [Application Lifecycle](https://sharpskill.dev/en/technologies/dotnet/interview-questions/application-lifecycle.md): 20 questions, Junior - [Dependency Injection](https://sharpskill.dev/en/technologies/dotnet/interview-questions/dependency-injection.md): 24 questions, Mid-Level - [Entity Framework Core](https://sharpskill.dev/en/technologies/dotnet/interview-questions/entity-framework-core.md): 25 questions, Mid-Level - [Minimal APIs](https://sharpskill.dev/en/technologies/dotnet/interview-questions/minimal-apis.md): 18 questions, Mid-Level - [Web API Development](https://sharpskill.dev/en/technologies/dotnet/interview-questions/web-api-development.md): 22 questions, Mid-Level - [Async in ASP.NET Core](https://sharpskill.dev/en/technologies/dotnet/interview-questions/async-aspnet-core.md): 20 questions, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/authentication-authorization.md): 18 questions, Mid-Level - [HttpClient & Networking](https://sharpskill.dev/en/technologies/dotnet/interview-questions/httpclient-networking.md): 20 questions, Mid-Level - [JSON Serialization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/json-serialization.md): 20 questions, Mid-Level - [Entity Framework Core Advanced](https://sharpskill.dev/en/technologies/dotnet/interview-questions/ef-core-advanced.md): 25 questions, Mid-Level - [C# Advanced Features](https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-advanced-features.md): 20 questions, Mid-Level - [Clean Architecture](https://sharpskill.dev/en/technologies/dotnet/interview-questions/clean-architecture.md): 20 questions, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/en/technologies/dotnet/interview-questions/logging-monitoring.md): 22 questions, Mid-Level - [Unit Testing & xUnit](https://sharpskill.dev/en/technologies/dotnet/interview-questions/unit-testing-xunit.md): 20 questions, Mid-Level - [Integration Testing](https://sharpskill.dev/en/technologies/dotnet/interview-questions/integration-testing.md): 18 questions, Mid-Level - [Docker & Containerization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/docker-containerization.md): 16 questions, Mid-Level - [NuGet Package Management](https://sharpskill.dev/en/technologies/dotnet/interview-questions/nuget-package-management.md): 16 questions, Mid-Level - [Memory Management & GC](https://sharpskill.dev/en/technologies/dotnet/interview-questions/memory-management-gc.md): 22 questions, Senior - [Reactive Programming](https://sharpskill.dev/en/technologies/dotnet/interview-questions/reactive-programming.md): 24 questions, Senior - [Async/await & Patterns](https://sharpskill.dev/en/technologies/dotnet/interview-questions/async-await-patterns.md): 26 questions, Senior - [.NET Design Patterns](https://sharpskill.dev/en/technologies/dotnet/interview-questions/dotnet-design-patterns.md): 24 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/dotnet/interview-questions/performance-optimization.md): 22 questions, Senior - [Security & Best Practices](https://sharpskill.dev/en/technologies/dotnet/interview-questions/security-best-practices.md): 24 questions, Senior - [SignalR & Real-time](https://sharpskill.dev/en/technologies/dotnet/interview-questions/signalr-realtime.md): 22 questions, Senior - [Microservices Architecture](https://sharpskill.dev/en/technologies/dotnet/interview-questions/microservices-architecture.md): 25 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/dotnet/interview-questions/csharp-basics