أسئلة القسم
تدرب على أسئلة المقابلات في هذا القسم. اكتب إجابتك، قم بتقييمها، أو اضغط على "عرض الإجابة" بعد التفكير.
What is .NET? Explain its architecture (CLR, CTS, etc.). سهل
.NET is a free, cross-platform, open-source developer platform for building applications (web, desktop, mobile, cloud, gaming, IoT).
Main components of .NET architecture:
- CLR (Common Language Runtime): Execution engine. Handles memory management, garbage collection, exception handling, JIT compilation.
- CTS (Common Type System): Defines how types are declared and used across all .NET languages (C#, VB, F#).
- CLS (Common Language Specification): A subset of CTS rules to ensure cross-language interoperability.
- BCL/FCL (Base Class Library / Framework Class Library): Provides reusable classes (collections, IO, networking, etc.)
What is different between .Net framework and .Net framework Core? سهل
Feature | .NET Framework | .NET Core / .NET (modern) |
---|---|---|
Platform | Windows only | Cross-platform (Win, Linux, macOS) |
Open Source | Partially | Fully open source (on GitHub) |
Performance | Slower (monolithic) | High performance, modular |
Deployment | Requires installation on system | Can be self-contained (xcopy deploy) |
Future | Legacy (no active dev) | Actively developed → .NET 8/9 |
What is Json? سهل
JSON (JavaScript Object Notation) is a lightweight, text-based format for data exchange.
- Human-readable, language-independent, used in APIs.
What is the difference between continue and break? سهل
- break → Exits the loop completely.
- continue → Skips current iteration, moves to next.
What is the difference between == and .Equals()? سهل
- == → Operator. By default, checks reference equality (for objects), value equality (for primitives/structs).
- .Equals() → Virtual method, can be overridden for custom equality.
What is the difference between const and readonly? سهل
const
- Compile-time constant
- Must be initialized inline
- Implicitly static
readonly
- Runtime constant
- Can be assigned in constructor
- Different value per instance possible
What is the difference between var, dynamic, and object? سهل
Keyword | Resolves at | Type safety | Use case |
---|---|---|---|
var | Compile time | Strongly typed | Inferred local variables |
dynamic | Runtime | No compile-time checking | Interop (COM, JSON, reflection) |
object | Compile time (base type) | Requires casting | General-purpose type |
What are default values of types in C#? سهل
- Value types: 0 for numeric, false for bool, '\0' for char.
- Reference types: null.
What is the difference between for and foreach? سهل
for:
- Index-based
- Flexible (can manipulate index)
foreach:
- Cleaner, read-only iteration
- Can’t modify underlying collection size
What is different between list and array? سهل
Feature | Array | List |
---|---|---|
Size | Fixed | Dynamic |
Performance | Faster (no overhead) | Slightly slower |
Type | Can be multi-dimensional | Generic, one-dimensional |
Methods | Limited | Rich methods (Add, Remove, etc.) |
Explain the difference between String and StringBuilder? سهل
String: Immutable → Every change creates a new object. StringBuilder: Mutable → Efficient for many modifications.
What are value and reference types? What is the difference between them? سهل
- Value types: Stored in stack, hold actual data. (e.g., int, struct).
- Reference types: Stored in heap, variable holds reference (e.g., class, string).
What is the difference between Stack<T> and Queue<T>? سهل
Stack
- Methods: Push(), Pop(), Peek().
Queue
- Methods: Enqueue(), Dequeue(), Peek().
How does HashSet<T> handle duplicates? سهل
HashSet
- Internally uses hashing; if hash code + equality match an existing item, new one is ignored.