1. Home
  2. Docs
  3. Interview Technical Quest...
  4. C# Technical Interview Qu...
  5. Section 1: C# Basics (1–15)

Section 1: C# Basics (1–15)

1. What is C#?
C# is a modern, object-oriented programming language developed by Microsoft for building Windows, web, and cloud applications.

2. What is CLR?
Common Language Runtime is the virtual machine component of .NET that executes C# code and manages memory, security, and exceptions.

3. What is CTS?
Common Type System ensures all .NET languages share common data types for interoperability.

4. What is CLS?
Common Language Specification defines rules that .NET languages must follow for compatibility.

5. Difference between value types and reference types?

  • Value types (int, float, struct) store data directly.
  • Reference types (class, array, string) store a reference to the data.

6. What is the difference between int and Int32?
They are identical; int is an alias for System.Int32.

7. What is a namespace?
A namespace organizes classes and prevents naming conflicts.

8. What is the difference between const and readonly?

  • const: compile-time constant, must be initialized at declaration.
  • readonly: runtime constant, can be initialized in constructor.

9. What is boxing and unboxing?

  • Boxing: converting value type to object.
  • Unboxing: converting object back to value type.

10. What is the difference between == and .Equals()?

  • == checks value equality for value types and reference equality for reference types.
  • .Equals() checks value equality and can be overridden.

11. What is a static class?
Cannot be instantiated; contains only static members.

12. What is a partial class?
Allows splitting the definition of a class into multiple files.

13. Difference between abstract class and interface?

  • Abstract: can have implemented methods and fields.
  • Interface: only method signatures (C# 8+ allows default methods).

14. What is the difference between public, private, protected, and internal?

  • public: accessible everywhere
  • private: accessible only within the class
  • protected: accessible in class and derived class
  • internal: accessible within the same assembly

15. What is the difference between String and StringBuilder?

  • String: immutable; every modification creates a new object.
  • StringBuilder: mutable; optimized for frequent modifications.

How can we help?