المتصفح مش سامح بحفظ التقدّم. تقدر تكمّل هنا، بس إجاباتك ممكن تضيع بعد قفل الصفحة.
مراجعة مركزة قبل الانترفيو
عندك انترفيو بكرة؟
اختار مستواك والوقت اللي معاك، واختبار قصير يساعدك ترتّب أولوياتك. بعدها راجع الأسئلة واختبر فهمك من جديد.
- 01 · اختبار سريع
- 02 · مراجعة حسب احتياجك
- 03 · اختبار ختامي
هتمتحن وتراجع إزاي؟
- جاوب 5 أسئلة من غير ما تفتح الشرح. النتيجة بترتّب أولوية المواضيع؛ مش تقييم شامل لمستواك.
- راجع الأسئلة المختارة حسب وقتك، وحاول تجاوب بصوتك قبل فتح الإجابة. لو الفكرة مش واضحة، افتح الدرس الكامل؛ هتلاقي الرسومات جنب شرحها هناك.
- ابدأ الاختبار الختامي، وجاوب كل الأسئلة واضغط «صحّح الاختبار». بعدها هتشوف الإجابات وتفسيرها، وتقدر ترجع للمراجعة.
5 أسئلة عشان نحدد الأولويات
جاوب قبل ما تفتح الشرح. تقدر تغيّر اختيارك لحد ما تضغط على النتيجة.
خطة المراجعة بتاعتك
اختبر اللي راجعته
ارجع للمراجعةقبل ما تدخل الانترفيو
حضّر تعريف قصير بنفسك، ومثال من شغلك، وقصة STAR. في سؤال Technical: ابدأ بالفكرة، اشرح مثالًا، وبعدها ناقش الـ trade-offs.
راجع طريقة الإجابة والتحضيرC# الأساسيات و OOP
36.1What are the four pillars of OOP?Junior
اربط الأسماء بمشكلة دفع واحدة: Encapsulation تمنع تعديل الرصيد من غير تحقق، و Abstraction تقدم PayAsync من غير كشف التفاصيل. Inheritance تسمح لـ Wallet تتخصص من PaymentMethod، و Polymorphism تخلي التنفيذ المناسب يشتغل من خلال نفس العقد.
بعد الأسماء امشِ على أول دفع ناجح والتاني المرفوض ووضح ليه الرصيد اتصان.
Encapsulation hides internal state and exposes controlled behavior. Abstraction exposes what something does, not how. Inheritance lets a class reuse and extend a base class. Polymorphism lets the same call behave differently depending on the runtime type, through virtual methods or interfaces. In practice I prefer composition and interfaces over deep inheritance hierarchies.
Async و Multithreading
36.2What is the difference between a Task and a Thread?Junior
Thread مسار تنفيذ يديره ، وله Stack وتكلفة إنشاء وجدولة. Task تمثل اكتمال عملية ونتيجتها أو فشلها؛ ممكن تكون بلا Thread محجوزة للانتظار.
Task.Run تستخدم ThreadPool لتنفيذ ، لكن مش كل Task تعمل بالطريقة دي. Cancellation طلب تعاوني للعمليات الداعمة، مش خاصية توقف أي Task بالقوة.
A thread is an operating-system thread with its own stack, expensive to create. A Task is a higher-level representation of an asynchronous operation and its eventual result. work in tasks runs on pooled threads, and tasks don't hold a thread while waiting. Tasks also give you return values, exception propagation, cancellation and composition, so modern code uses tasks rather than raw threads.
ASP.NET Core و MVC
36.3What is middleware and how does next work?Junior
تلف المرحلة التالية: كود قبل await next للطلب الداخل، وكود بعدها لمسار الرجوع.
لو المرحلة رجعت Response من غير next، فاللي بعدها مش هيتنفذ. ده يفسر ليه ترتيب Logging و Error handling و Authentication مهم؛ الترتيب جزء من السلوك اللي ممكن تلاحظه في نفس Request.
forms the processing pipeline. A component can inspect or change the request, call next to run downstream components, and do more work as the response unwinds. It can also short-circuit, for example by rejecting a request without calling next. Ordering therefore determines both what runs and what context is available. I place broad exception handling early enough to wrap the relevant components and authentication before authorization that needs the user identity.
SQL وقواعد البيانات
36.4Explain inner and outer joins using customers and orders.Junior
INNER ترجع العملاء والطلبات اللي لهم Match. LEFT تحتفظ بكل العملاء، و RIGHT بكل الطلبات، و FULL بالطرفين مع null لأن الغياب.
عميل له ثلاث Orders يظهر في ثلاث Pairs؛ ده متوقع مش Duplicate bug تلقائيًا. راجع مفتاح الربط قبل التجميع عشان ما تضاعفش الإجماليات من غير قصد.
I use an inner join when I need only matching customers and orders. A left join retains all customers and fills order columns with when none match. A right join preserves all orders, while a full outer join retains unmatched rows from both sides. Multiple matching orders repeat the customer columns, which is expected. I am careful with right-side filters after a left join, because a WHERE predicate can remove the unmatched rows.
Security
36.5What is the difference between authentication and authorization?Junior
الأولى إثبات الهوية، والتانية السماح بالفعل على resource معينة. Login مش إثبات ملكية invoice، و 401 غير 403.
مستخدم موثّق ممكن يطلب Invoice مش ملكه؛ الفحص لازم يكون على المورد نفسه. 401 للاعتماد الغايب أو غير المقبول، و 403 للرفض؛ ممكن 404 حسب سياسة إخفاء وجود المورد.
I use authentication to establish who is calling and authorization to decide what that identity may do. A valid login does not imply access to every order. In an I normally challenge missing or invalid credentials with 401 and reject insufficient permission with 403, while sometimes using 404 to avoid revealing resource existence. In I establish the principal before applying endpoint policies and perform ownership and tenant checks when the decision depends on a specific resource.
Entity Framework Core
36.6Why is DbContext a unit of work, and how long should it live?Junior
تجمع Entities المتتبعة وتغيراتها للحفظ كوحدة شغل.
خلي عمرها قصيرًا، وغالبًا Scope الطلب مناسبة؛ متخزنهاش Singleton ومتستخدمهاش من Tasks متزامنة لأنها مش Thread-safe. Unit of work هنا لا تضم تلقائيًا Payment أو كل Database خارج نطاق اتصالها.
I treat as a short-lived unit of work because it tracks related entity changes and submits them through SaveChanges. In a web application it is commonly scoped to a request, while a background worker can create one per operation through a factory. I dispose it promptly and never share it across concurrent operations. Long-lived contexts accumulate state and stale entities, so I avoid using them as an application cache or singleton.
LINQ و Collections
36.7What is the difference between Select and SelectMany?Junior
Select تحول كل Order لنتيجة واحدة، زي . SelectMany تاخد Lines لكل Order وتفردها في Sequence واحدة؛ Order بلا Lines تضيف صفر عناصر.
اسأل هل عايز عدد النتائج مرتبط بالطلبات ولا ببنودها، وبعدين اختار العملية. ده يمنع خلط للطلب مع Flattening للعلاقة.
Select maps each input to one result. If I select an order's Lines property, the result is a sequence of line collections. SelectMany maps each input to a sequence and flattens those sequences, so I get all order lines together. An order with no lines contributes no elements. When I also need the order identifier, I use the result-selector overload to combine the outer order with each inner line.
SOLID و Architecture
36.8How do you explain SOLID without just expanding the acronym?Junior
ابدأ من ألم ملموس: تعديل إيميل بيغير حساب فاتورة، أو Subtype بتكسر توقع العميل.
بعدها اربط المشكلة بمبدأ المناسب ووضح تكلفة الفصل.
حفظ الأسماء من غير مثال سلوك مش هيوضح إزاي المبدأ يساعدك تختار تصميم.
I explain as managing change and contracts. Single responsibility keeps unrelated reasons to change separate. Open/closed supports new variants through stable extension points. Liskov requires implementations to honor the behavior clients expect. Interface segregation gives clients focused capabilities. Dependency inversion keeps business policy independent of infrastructure details through suitable abstractions. I apply them where they reduce real coupling; I would not add interfaces and layers everywhere merely to make the code look compliant.
Testing
36.9How do unit, integration and E2E tests differ?Junior
الـ unit بيفحص سلوك صغير من غير infrastructure، والـ integration بيفحص التوصيل الحقيقي، والـ بيجرب رحلة مستخدم كاملة. اختار المستوى اللي يمسك الخطر بأقل تكلفة تشخيص.
قواعد الخصم تتراجع بسرعة في Unit ، لكن ترجمة Query وتسجيل يحتاجوا Integration. تكرار كل حالة حسابية في E2E بيزود التكلفة وصعوبة تحديد السبب من غير تغطية خطر جديد.
I distinguish them by the boundary they exercise. A unit test checks a small behavior without infrastructure, an integration test checks components working together, and an test exercises a complete user journey. I use units for calculation rules, integration tests for persistence and wiring, and selected E2E tests for checkout. I choose the cheapest level that can actually detect the failure rather than copying every scenario into all three layers.
مسائل Coding بالحل
36.10Find two numbers in an array that sum to a target. What is the complexity?Junior
أحتفظ بالقيم السابقة ومواضعها في Dictionary.
عند القيمة الحالية أسأل هل المكمل ظهر قبل كده، ثم أضيف القيمة؛ ترتيب الخطوتين يمنع استخدام نفس العنصر مرتين. مع Hashing مناسب المرور متوقع O(n) وقت وO(n) مساحة. لو البيانات مرتبة، Two Pointers تقلل المساحة إلى O(1)، لكن ترتيبها من الصفر له تكلفة وممكن يضيع Original Indices. في المثال الصيغة المكتوبة هي target - x.
I iterate once, keeping a dictionary from value to index. For each number I check whether the target minus that number is already in the dictionary; if so I return both indices, otherwise I store the current one. That's O(n) time and O(n) space, instead of O(n squared) for checking every pair. If the array is sorted, two pointers give O(n) time with constant space.
Behavioral و Career
36.11Tell me about a time you disagreed with a teammate.Mid
اختار خلافًا حقيقيًا وافصل رأي الطرفين والقيود، ثم اشرح إيه الدليل اللي جمعتوه وإزاي اتحسم القرار.
نجاح الموقف ممكن يكون إنك اقتنعت ببديل زميلك. استخدم مثال Checkout هنا للتدريب على الترتيب فقط، واستبدله بخبرتك من غير أسماء عملاء أو تفاصيل سرية.
During a checkout change, a teammate preferred introducing a separate service, while I was concerned about boundaries and delivery time. I was responsible for clarifying the trade-offs, so I asked what independent scaling we actually needed and compared both options in a short design note. We agreed to keep the change local with explicit module boundaries and a review point after measuring load. I documented the decision and supported the implementation, including parts where my teammate's approach improved the design.
C# الأساسيات و OOP
36.12Interface vs abstract class: when would you use each?Junior
لو خدمة محتاجة عملية Refund من أكتر من نوع، interface تصف القدرة من غير فرض Base class.
لو تقارير فعلًا تشترك في State وخطوات تنفيذ، abstract class ممكن تثبت الجزء المشترك. المقابل إن النوع له Base class واحدة، فمتستخدمش Inheritance لمجرد توفير سطرين متشابهين.
An interface defines a capability; a class can implement many, and an interface cannot declare instance fields. An abstract class is a partial base type: it can have instance state, constructors and shared implementation, but a class inherits only one. I default to interfaces for flexibility and testability, and use an abstract class when several types share code, like a base report that defines the export flow.
C# الأساسيات و OOP
36.13What is the difference between a class and a struct?Junior
الـ class reference type: عند assignment بننسخ الـ Reference، فممكن متغيرين يشاوروا لنفس الـ Object. الـ struct value type: بننسخ القيمة، بما فيها أي references جواها؛ ده مش deep copy للـ Objects اللي الـ References بتوصل لها.
مكان التخزين يتوقف على الاستخدام وتحسينات الـ runtime، مش قاعدة stack مقابل heap. الكلاس يقدر يرث base class واحدة؛ الـ struct ما يقدرش يرث struct أو class أخرى، لكنه يقدر يطبق interfaces. أختار struct لقيمة صغيرة مناسبة للنسخ، وغالبًا ، وأقيس تكلفة النسخ والـ بدل حد حجم إلزامي.
A class is a reference type: assignment copies a reference, so two variables can refer to the same object. A struct is a value type: assignment copies its value, including any reference fields, rather than deep-copying their objects. Storage depends on context and runtime optimization, not a universal stack-versus-heap rule. A class can inherit one base class; a struct cannot inherit another struct or class, but can implement interfaces. I consider structs for small, preferably values and measure copying and costs rather than treating a size guideline as a language limit.
Async و Multithreading
36.14What is the difference between synchronous and asynchronous programming?Junior
لو بتحجز Thread لحد الرد، الطلبات المتزامنة هتحتاج Threads أكتر. Async I/O تسمح باستخدام الـ Thread أثناء الانتظار، ثم تكمل عند جاهزية النتيجة.
ده يحسن قابلية الخدمة لاستيعاب الحمل؛ مش شرط يقلل زمن مكالمة الشبكة نفسها، و async وحدها لا تنقل الحساب إلى Thread أخرى.
Synchronous code blocks the thread until an operation completes. Asynchronous code starts the operation, releases the thread while waiting, and continues when the result arrives. In a web that lets the same thread pool handle many more concurrent requests during , so it improves and scalability rather than the speed of a single request.
Entity Framework Core
36.15How do eager, lazy and explicit loading differ?Junior
Include تطلب العلاقات مقدمًا، و Explicit loading تجيبها بنداء واضح لاحقًا، و Lazy loading قد تنفذ عند الوصول للخاصية إذا مفعلة.
لو الشاشة محتاجة ثلاث قيم فقط، ممكن تجيبهم مباشرة. قارن عدد الرحلات وحجم الصفوف؛ تحميل كل Graph مش حل تلقائي لكل قراءة.
I use eager loading when I know I need related entities, expressing that through Include and ThenInclude. Lazy loading fetches a when accessed, which is convenient but can hide queries. Explicit loading deliberately loads a relationship through the context entry . For read endpoints I often prefer into a because it fetches only the required values. I choose based on the required shape and measured query behavior, not convenience alone.
SQL وقواعد البيانات
36.16What is the difference between WHERE and HAVING?Junior
WHERE تصفي Rows قبل التجميع، و HAVING تصفي Groups بناءً على النتيجة المجمعة.
لو المطلوب Orders المدفوعة لعملاء مجموع مشترياتهم فوق حد، فلتر Status في WHERE وحد SUM في HAVING. ده ترتيب منطقي للمعنى، والـ Optimizer قد تغير خطة التنفيذ مع الحفاظ على نفس النتيجة.
I use WHERE to filter individual rows before grouping and HAVING to filter groups. For example, WHERE selects paid orders in a date range, and HAVING keeps customers whose total spending exceeds a threshold. I put conditions that do not need aggregates in WHERE when that matches the intended meaning. Logical processing also explains why a SELECT alias is normally unavailable in WHERE but can be used in ORDER BY.
Security
36.17How do you prevent SQL injection in .NET?Junior
Parameters مش concatenation. أو FromSql بـ interpolation مباشرة، و identifiers من allowlist. Validation و least privilege طبقات إضافية.
القيمة تبقى Parameter ؛ اسم Column أو اتجاه Sort ماينفعش يتحولوا Parameters بالطريقة نفسها، فاختارهم من Allowlist. Stored Procedure أو مش ضمان لو جواها Dynamic غير آمنة.
I keep values separate from syntax using parameters, usually through or a parameterized command. If I use EF FromSql, I pass the interpolated expression directly so it remains parameterized instead of building a string for FromSqlRaw. Parameters cannot represent identifiers such as column names, so dynamic sorting uses a fixed allowlist. Input validation and a least-privileged database account add protection, but neither replaces correct parameterization.
HTTP و Networking
36.18What happens when you type an HTTPS URL into a browser?Junior
تحليل ، و caches، و ، و و لو connection جديدة، و ، وبعدين parsing و layout و paint. HTTP/3 بيغير transport.
لو Connection مستخدمة من Pool ، ممكن ماتحتاجش DNS و Handshake جديدة لكل Request. افصل زمن تهيئة الاتصال عن زمن قبل اختيار التحسين.
I break it into stages. The browser parses the and checks relevant caches, resolves the hostname, establishes a connection if one cannot be reused, and negotiates for . It sends the request, receives headers and content, then parses resources and performs rendering. For -based HTTPS there is a TCP handshake before TLS; HTTP/3 uses instead. Caching and connection reuse can skip substantial parts of this sequence.
C# الأساسيات و OOP
36.19How do you handle exceptions properly?Junior
لو الفشل Payment decline متوقعة في العقد، رجع Outcome واضحة بدل تجاهلها. امسك Exception محددة لما تقدر تعالجها أو تضيف سياقًا مفيدًا، واستخدم using للتنضيف.
الفشل غير المتوقع يمر لـ Handler عام مع Logging مناسب. متحولش كل Exception إلى نجاح، ومتكررهاش تلقائيًا من غير معرفة هل الأثر آمن للإعادة.
I catch only specific exceptions I can actually handle, use filters when a condition matters, and release resources with using or finally. I never swallow exceptions silently, and I don't use them for expected outcomes like not-found or validation failures; those return results. Rethrows use throw;. In an , a global exception handler logs details and returns a ProblemDetails response without leaking internals.
Entity Framework Core
36.20When should you use AsNoTracking?Junior
AsNoTracking مناسبة لقراءة Entities مش هتعدلها وتحفظها من نفس Context. لقيم فقط لا تتبع Entity أصلًا، لكن Projection تحتوي Entity ممكن تتبعها حسب الإعداد.
لو نفس المفتاح بيتكرر في النتيجة، راجع Identity resolution؛ غياب التتبع ومشاركة نفس Instance سؤالان مختلفان.
I use AsNoTracking when I need entity results for reading but will not modify and save them through that context. It avoids persistent change-tracker bookkeeping. A pure scalar or already has no entities to track, but a projection containing an entity can still track it. If repeated keys in a read-only graph should share one object instance, I consider AsNoTrackingWithIdentityResolution. I measure memory and query behavior rather than assuming every no-tracking query must be faster.
Data Structures و Algorithms
36.21What does Big-O notation tell you?Junior
Big-O تصف حد نمو تكلفة الوقت أو المساحة لما حجم البيانات يكبر.
لازم أقول n تمثل عدد إيه، وهل الكلام Worst-case ولا Expected ولا Amortized. لو عندي قائمتان مستقلتان طولهما n وm، أذكر الاتنين؛ الرمز مش زمنًا ثابتًا ولا يغني عن قياس الـ والـ Memory.
I use Big-O to describe how time or space grows with input size, ignoring constant factors and smaller terms. I define what each input size represents and state whether I mean worst-case, expected or amortized cost. A linear scan is O(n), binary search is O(log n), and comparing every pair is O(n squared). It does not predict seconds, so I still consider , cache behavior and and measure performance when practical differences matter.
مسائل Coding بالحل
36.22How do you check whether a string has balanced brackets?Junior
Stack تحفظ الأقواس المفتوحة؛ عند قوس مقفول لازم فيه عنصر يطابق نوعه في الـ Top، وبعدها Pop.
لو فيه اختلاف أو نقص نرفض فورًا، وفي النهاية لازم الـ Stack فاضية علشان ما نسيبش أقواس مفتوحة. ده O(n) وقت وO(n) مساحة في أسوأ حالة؛ اتفق على التعامل مع أي Characters تانية.
With a stack: I push every opening bracket, and on a closing bracket the stack must be non-empty and its top must be the matching opener, which I pop. At the end the stack must be empty. That's O(n) time and space.
C# الأساسيات و OOP
36.23What are nullable value types and nullable reference types?Junior
int? تضيف إمكانية null إلى Value type.
أما string? في Nullable reference types فهي Annotation تساعد الـ Compiler تحذر من الاستخدام غير الآمن؛ مش نوع Runtime منفصل يمنع null فعليًا. تعامل مع البيانات الخارجية بالتحقق، ومتستخدمش ! لإسكات التحذير من غير سبب يثبت الأمان.
int? is a nullable value type, short for Nullable of int. Nullable reference types, enabled by default in new projects, make the compiler track nullability: string should never be null and string? may be, and you get warnings when dereferencing something that might be null. I treat those warnings as errors and handle nulls with ?., ?? and ??=, plus C# 14's null-conditional assignment.
SQL وقواعد البيانات
36.24Why normalize a relational model?Junior
Normalization تقلل تناقض تحديث نفس Fact في أماكن متعددة. 1 NF تتعامل مع القيم والعلاقات المناسبة، و 2 NF تزيل Partial dependencies على جزء من Candidate key المركبة، و 3 NF و تعالج Dependencies بشروط أدق.
ابدأ بالـ Functional dependencies الفعلية؛ Shipping snapshot تاريخية ممكن تكون Fact مختلفة عن Current address.
I normalize to reduce update, insert and delete anomalies by storing each current fact with the key it depends on. First normal form removes repeating groups. Second normal form removes partial dependencies of non-prime attributes on candidate keys. Third normal form addresses non-key dependency problems, while requires every nontrivial determinant to be a . I balance the design with real constraints and workloads, and distinguish historical snapshots from accidental duplication.
C# الأساسيات و OOP
36.25decimal vs double vs float: which one for money and why?Junior
لحساب فاتورة، decimal عادةً أنسب لأنها تمثل الكسور العشرية زي 0.1 بدقة ضمن حدودها. float و double تمثيلهم Binary، فالمقارنة في المثال الأولى False.
لكن decimal مش تلغي الحاجة للتقريب: 1 مقسومة على 3 لسه محتاجة سياسة. حدد العملة وعدد المنازل وطريقة التقريب بجانب اختيار النوع.
For money I always use decimal. It's a base-10 type with 28 to 29 significant digits, so values like 0.1 are exact. float and double are binary floating point: fast and with a huge range, but 0.1 + 0.2 isn't exactly 0.3, which is unacceptable for currency. decimal is slower and uses 16 bytes, so scientific and graphics code uses double. The literal suffixes are m for decimal and f for float; an unsuffixed literal like 10.5 is a double.
Async و Multithreading
36.26Why is async void dangerous?Junior
async void لا تعيد Task، فالـ Caller ما يقدرش ينتظر اكتمالها أو يلتقط فشلها عبر await.
Exceptions بتتسلم للـ Context أو Runtime حسب البيئة، وممكن تنهي التطبيق. الاستثناء المعتاد Event handler بتوقيع void؛ حاول تفصل شغلها في Task-returning method قابلة للانتظار والاختبار.
An async void method returns no Task that its caller can await or use to observe failure. Unhandled exceptions are dispatched through the captured SynchronizationContext or runtime handling; the caller cannot catch them by awaiting the call, and they may terminate the process depending on the environment and its exception handling. Reserve async void for event-handler signatures that require void. Prefer Task or another suitable awaitable return type for other asynchronous methods.
ASP.NET Core و MVC
36.27Explain MVC and the responsibility of a controller.Junior
لو Controller تستقبل إنشاء Order، دورها تربط input بالعملية وترجع Response مناسبة.
Model تمثل البيانات والسلوك، و View مسؤولة عن العرض في . مش لازم Model تكون entity، ووضع كل قواعد الدفع في Controller هيصعب اختبارها وإعادة استخدامها. خلي مسؤولية كل جزء واضحة من مسار طلب حقيقي.
I describe as separating the model's data and behavior, the view's presentation and the controller's request coordination. Routing selects an action, which binds input, calls application behavior and chooses a response. I keep business rules out of controllers so they can be tested and reused independently of . The model is not limited to an entity; a view model can contain exactly what a page needs without exposing persistence details.
Web APIs و REST و gRPC
36.28How do 401 and 403 differ?Junior
401 تعني إن الطلب محتاج Credentials صالحة مع Challenge مناسبة، و 403 رفض السماح حسب السياسة رغم فهم الهوية أو الطلب.
أحيانًا 404 تستخدم لإخفاء وجود Resource وفق سياسة معلنة. افصل التحقق من عن Ownership؛ امتلاك Token صحيحة مش يسمح بقراءة كل OrderId.
I return 401 when the request needs valid authentication credentials, for example because a bearer is missing or invalid, with the appropriate authentication challenge. I use 403 when authorization refuses the operation, usually after the caller has authenticated. For sensitive resources I may deliberately return 404 to avoid disclosing existence, following a consistent policy. In all cases I check access to the specific order, not just whether the caller has a valid token.
Caching و Redis
36.29What is cache-aside?Junior
اقرا cache، ولو miss حمّل المصدر وخزن مع . في الكتابة حدث المصدر وبعدين invalidate، مع فهم races.
مثلًا Product ناقصة من Cache فتتقري من Database ، وبعدها يتحفظ Copy. لازم Checkout تراجع السعر المعتمد بدل اعتبار نسخة العرض قرار تحصيل.
I implement by checking the cache, loading the authoritative source on a miss, and storing a copy with a bounded lifetime. The application owns that flow and invalidates related entries after a committed write. It is a good fit for read-heavy data with tolerated staleness. However, concurrent misses can overload the source, and readers can repopulate old values around a write, so I also consider single-flight loading and a deliberate consistency policy.
Logging و Observability
36.30What are logs, metrics and traces used for?Junior
Logs تفاصيل حدث، و metrics اتجاهات مجمعة، و رحلة request. استخدمهم مع بعض عشان تربط حجم التأثير بمكانه وتفاصيله.
ابدأ بـ Metric توضح حجم البطء، ثم Trace تحدد الخطوة الأبطأ، و Log تفسر الحدث. كل أداة بتكمل سؤال ناقص عند التانية بدل تجميع بيانات بلا مسار للتحقيق.
I use metrics to understand behavior such as traffic, failure rate and , logs for detailed event context, and to follow a request across components. I connect them with service metadata and trace identity so I can move from a symptom to an affected request and its details. Each has a cost and limitation: metrics lose event detail, logs can become expensive, and sampled traces may not include every request. Together they support investigation rather than automatically proving a root cause.
Docker و CI/CD و Git
36.31What is CI/CD?Junior
build و tests مع الدمج، و delivery جاهزية للنشر، و deployment نشر تلقائي بعد البوابات.
اشرح الفرق في قرار الإنتاج، مش اختصار CI/ بس. نجاح Tests لوحده مش بيختار إزاي Migration أو التصرف في Rollback.
I use continuous integration to build and test small changes frequently so integration problems surface early. Continuous delivery keeps passing artifacts ready for deployment, often with a production approval. Continuous deployment automatically deploys changes that pass the release gates. My pipeline produces a versioned artifact, verifies it in staging and promotes the same content to production. I separate environment configuration from the artifact and define rollback and observability before enabling automatic releases.
Behavioral و Career
36.32What questions would you ask us?Junior
أختار أسئلة إجابتها هتغير فهمي للدور، زي نتيجة أول 90 يوم أو قرار تقني قريب أو التعلم من Incident.
أتجنب تكرار سؤال اتجاوب بالفعل وأناسبه بالشخص والوقت المتاح. مثال عملي من الفريق غالبًا يكشف تفاصيل أكتر من سؤال عام عن الثقافة.
I would like to understand what success in the first three months would look like and which problem the new engineer should help solve first. I would also ask how the team reviews technical decisions and whether you can describe a recent trade-off. If time allows, I would ask about production ownership and how lessons from incidents become improvements. Those answers would help me understand the work, how I could contribute and whether the team's expectations match the role we have discussed.
إزاي تذاكر وتعدّي الانترفيو
36.33Tell me about yourself.Junior
ابدأ بالمسؤولية اللي بتقوم بيها دلوقتي، وبعدها اختار إنجاز أو اتنين يوضحوا أثر شغلك، ثم اربط ده بالوظيفة.
مثلًا تحسين Query تبقى قصة مفيدة لو تقدر تشرح القياس والسبب. النموذج الإنجليزي تدريب على ترتيب الإجابة؛ استبدل تفاصيله بخبرة حقيقية تخصك.
I'm a backend engineer with several years of experience building web with , and Server. In my current role I own the order and payment services, and recently I cut the main page's response time by two thirds by fixing queries and adding caching. Before that I built internal reporting tools used daily by the finance team. I'm looking for a team working on larger systems where I can grow in architecture, which is why this role interested me.
الـ AI في .NET: RAG و Embeddings و MCP
36.34What are tokens and a context window?Junior
قطعة نص بيحسبها الـ Model، ومش شرط كلمة كاملة.
الـ Context Window بتحدد المساحة المتاحة للتعليمات والـ History والمصادر والرد حسب الـ Model. في تطبيق عربي لازم تقيس بالـ Tokenizer الفعلي؛ قاعدة عدد كلمات إنجليزية ممكن تدي تقديرًا مضللًا، ولازم تسيب مساحة للرد بدل ما تملا الطلب كله.
I treat as the model's text units rather than words. The tokenizer may split one word into several pieces, and languages tokenize differently. The context window limits how much information a call can consider, including instructions, history and retrieved evidence, with output limits depending on the model. I measure actual token usage, reserve space for the response and trim history deliberately. A larger window does not guarantee that every fact will be used correctly.
الـ AI في .NET: RAG و Embeddings و MCP
36.35What does MCP standardize?Junior
تنظم اتصال Host بخدمات خارجية: Client تتصل بـ Server تعرض Tools وResources وPrompt Templates.
الـ Host يدير استخدام القدرات مع الـ Model. التوحيد ده يسهل Integration، لكنه مش Agent Loop ولا Authorization تلقائية؛ لازم تحقق وصلاحيات على الـ Server لكل عملية.
I describe as a protocol for connecting applications to external capabilities. A host uses clients to communicate with servers that can expose callable tools, readable resources and reusable prompt templates. Local servers often use stdio, while remote deployments can use Streamable . This makes integrations reusable across compatible hosts. MCP does not choose the model or automatically secure the application; I still need authentication, per-tool authorization, least privilege and clear handling of sensitive actions.
LINQ و Collections
36.36Why are Dictionary and HashSet useful for repeated lookups?Junior
لو بتبحث عن Product لكل Order line، Dictionary تربط الـ Id بالـ Product بدل Scan متكررة. لو المطلوب اختبار وجود Id فقط، HashSet أوضح.
متوسط البحث O(1) في ظروف مناسبة، لكن Hash و Equality و Collisions يؤثروا، وفيه كلفة بناء وذاكرة. حدد Comparer ومعنى التكرار قبل بناء الفهرس.
I use Dictionary for key-to-value lookup and HashSet for membership and uniqueness. Their usual lookup cost is constant time on average, compared with a linear scan through a List. Building one index can replace repeated nested scans and reduce expected total work substantially. That trades extra memory and construction cost for faster reuse. I also choose the equality comparer deliberately and avoid mutable keys, because collisions and inconsistent hashing can undermine performance or correctness.
ASP.NET Core و MVC
36.37What are the three DI lifetimes, and what is a captive dependency?Mid
Transient تتعمل لكل Resolve، و Scoped يعاد استخدامها داخل Scope، و Singleton تعيش مع Root provider.
لو Singleton احتفظت بـ Scoped مباشرة، عمر الـ Context ممكن يمتد لطلبات مختلفة: دي Captive dependency. BackgroundService تقدر تنشئ Scope لكل وحدة شغل وتخلصها؛ مش تخزن الـ Scoped instance خارجها.
Transient creates an instance per resolution, scoped shares one within a scope, and singleton shares one within the root service provider. A request normally supplies a scope. A captive dependency occurs when a longer-lived service retains something intended to be shorter-lived, such as a singleton capturing a scoped . That can share unsafe state across requests. I enable scope validation and create explicit scopes for singleton background units of work, keeping scoped objects inside those scopes.
Async و Multithreading
36.38How do async and await work under the hood?Mid
الـ Compiler تحول Async method إلى State machine تحفظ القيم ونقطة الاستكمال. عند await لـ Task غير مكتملة، تسجل Continuation وتعيد التحكم للمستدعي.
الاستكمال يتبع الـ Context والـ Scheduler المناسبين، ومش شرط Thread جديدة أو من الـ Pool دائمًا. ولو Task مكتملة بالفعل، ممكن التنفيذ يكمل فورًا.
The compiler rewrites a Task-returning async method into a state machine. It starts synchronously; an already-completed await continues synchronously. When an awaited Task is incomplete, the method saves its state, registers a continuation and returns control to the caller without reserving that thread for the wait. True asynchronous network need not occupy a waiting thread, although some async offload blocking work. By default, a Task awaiter targets the current SynchronizationContext or a non-default TaskScheduler; otherwise continuation placement follows completion and scheduling rules, not an unconditional new-thread or ThreadPool guarantee. contexts commonly route continuations to the UI thread; supplies no custom SynchronizationContext by default. Unhandled exceptions are stored in the returned Task and observed when it is awaited.
Entity Framework Core
36.39How do you diagnose and fix an N+1 query problem?Mid
لو Log فيها Query أولى ثم نفس بتتكرر بآي دي مختلفة عند قراءة لكل Row، اشتبه في .
أو Include مناسبة ممكن تقلل الرحلات حسب المطلوب. متحاولش تحلها بـ Task.WhenAll على نفس ؛ ده استخدام متزامن غير مدعوم ويخفي أصل نمط التحميل.
I look at database command logs or for one list query followed by repeated queries with different identifiers. That usually comes from lazy loading or explicit loading inside a loop. I replace it with a that computes the required values in , or eager loading if entities are needed. I then verify query count, payload and . Running those queries concurrently on one is invalid and does not address the underlying access pattern.
Security
36.40Is a JWT encrypted, and what must an API validate?Junior
Signed المعتادة مش encrypted؛ validate signature و issuer و audience و lifetime والخوارزمية المسموحة. Decode بس مش validation.
تغيير role في Payload ثم فك الترميز ممكن ينجح، لكن Signature Validation لازم ترفض القيمة المعدلة. التوقيع بيحمي سلامة المحتوى، مش بيخفيه عن اللي ماسك .
I treat the usual signed as readable data, not encrypted storage. Its header and payload are Base64Url-encoded, and the signature protects integrity under a trusted key. The validates the signature, accepted algorithms, issuer, audience and lifetime with an intentional clock-skew allowance. I obtain keys through trusted provider metadata and support rotation rather than accepting arbitrary -supplied keys. Decoding a token is only inspection; it does not establish that the claims are trustworthy.
Web APIs و REST و gRPC
36.41How would you make a payment endpoint retry-safe?Mid
لما الرد يضيع بعد الدفع، العميل يعيد نفس key للعملية، والسيرفر يحجزها بشكل Atomic مع Request hash وحالة ونتيجة متينة.
نفس المفتاح مع بيانات مختلفة تعارض. الأثر الخارجي محتاج Provider idempotency و Reconciliation لحالة النتيجة غير المعروفة؛ تخزين Response محليًا بعد الدفع فقط يترك فجوة فشل.
I require a stable key per logical payment and scope it to the caller and operation. A unique database constraint arbitrates concurrent requests, and I store a payload hash to reject key reuse with different input. Completed attempts replay the recorded response, while in-progress behavior and expiry are documented. Local changes commit atomically. For an external payment provider I also reuse its idempotency mechanism and reconcile uncertain outcomes rather than assuming my database covers the remote charge.
LINQ و Collections
36.42What changes when IQueryable becomes IEnumerable before filtering?Mid
AsEnumerable تبدل ربط الـ Operators التالية إلى Enumerable، لكنها وحدها لا تنفذ Query ولا تحمل كل البيانات. عند التعداد، الجزء السابق يجيب البيانات، والفلتر التالي يشتغل محليًا.
لو نقلت Where من قبل الحد ده لبعده، ممكن ترجع Rows أكتر من Database؛ راجع وحجم النقل.
The later Where binds to Enumerable and receives a rather than an for translation. With an source, the database query before that boundary still runs on enumeration, but the later filter runs in over returned rows. AsEnumerable itself does not execute or buffer. I keep translatable filters and projections before the boundary, inspect generated , and move to client processing only after deliberately limiting the server result.
SQL وقواعد البيانات
36.43What is the difference between clustered and nonclustered indexes?Mid
في Server rowstore، Leaf level في Clustered index تحتوي Data rows، و Nonclustered index بنية منفصلة بمفاتيح و Row locator.
Primary key مش لازم تكون Clustered. لا تعتمد على ده لعرض ترتيب بلا ORDER BY؛ اختار المفتاح حسب أنماط القراءة والكتابة وحجم المفاتيح والمقابل على باقي الـ Indexes.
In Server rowstore, I can organize a table as a clustered index whose leaf level contains the data rows, or as a heap. A nonclustered index is a separate structure with keys and a row locator, using the clustered key or a heap RID. A primary key need not be clustered. I choose index keys for access patterns and consider included columns for coverage, while remembering that output order still requires ORDER BY.
SOLID و Architecture
36.44What is dependency inversion versus dependency injection?Mid
تمرير Concrete في Constructor يعتبر Dependency Injection ، لكن Order Policy لسه عارفة تفاصيل المزود.
Dependency Inversion بتغير اتجاه الاعتماد لعقد يناسب السياسة.
بتوصل التنفيذ، و بتحدد مين يعتمد على مين؛ الاتنين ممكن يجتمعوا لكن مش نفس القرار.
Dependency inversion is about source dependency direction: high-level policy depends on abstractions, and lower-level details implement those abstractions. Dependency injection is a construction technique that supplies collaborators from outside, usually through constructors. I can inject a concrete and still couple policy to infrastructure, so injection alone is not inversion. I define the contract around what the use case needs and let the composition root connect it to an adapter.
Messaging و Distributed Systems
36.45What problem does the transactional outbox solve?Mid
Dual write بين و . الـ event يتسجل مع الداتا في واحدة، وبعدها dispatcher ينشر. التكرار لسه ممكن ومحتاج consumer .
لو التطبيق وقع بعد Commit وقبل النشر، Dispatcher تقدر تكمل من . ولو وقعت بعد النشر وقبل تسجيله، احتمال التكرار يفسر ليه Consumer لازم يحمي الأثر.
I use an to avoid the gap between committing business data and publishing its event. The application writes both the business change and an outbox row in the same database . A dispatcher later publishes with confirmation and records success. A crash after publishing but before recording success can cause another publication, so the message ID stays stable and consumers handle duplicates. I also plan safe row claiming, retries, ordering where required, and monitoring of the oldest unsent record.
Testing
36.46How would you integration-test an ASP.NET Core API?Mid
WebApplicationFactory للـ pipeline، و Testcontainers لنفس database engine، و migrations قبل الداتا، و fake للـ external payment بس. تحقق من response ومن التخزين.
نجاح Status مش كفاية لو Order ماتحفظتش. تحقق من نتيجة العميل ومن التغيير في Database ، وعزل External Payment يمنع تكلفة أو أثر حقيقي أثناء الاختبار.
I host the with WebApplicationFactory, start a disposable database through Testcontainers, and configure the application to use it before the host starts. I apply migrations and seed only the scenario's data. Requests then exercise , routing, validation and persistence together. I replace external payment calls with a fake and inspect stored state through a fresh scope. I also run deployment checks separately because the default TestServer does not validate real or proxy configuration.
Behavioral و Career
36.47Tell me about a mistake you made.Mid
قول الخطأ ودورك بوضوح، وبعده إزاي قللت الضرر وتحققت من الإصلاح وعدلت طريقة الشغل.
مثال Query اللي اتجربت على بيانات قليلة يشرح الشكل، مش قصة تنسبها لنفسك. ما تخترعش نسبة تحسن أو وقت Rollback؛ لو مش معاك رقم، اشرح دليلًا وصفيًا تقدر تناقشه.
I once approved a query change after testing only with a small dataset. Under a larger workload it became too slow, and I had missed that risk. I helped revert the change, reproduced the issue with representative data and reviewed the execution plan before making a smaller fix. I then added a performance review step for similar queries and shared what I had overlooked. The lesson was to validate workload assumptions before release rather than treating functional correctness as sufficient evidence.
Async و Multithreading
36.48What is a CancellationToken and how do you use it?Mid
CancellationToken إشارة تقول إن الـ Caller مبقاش محتاج استمرار الشغل. مررها للـ الداعمة وافحصها في الحساب الطويل؛ Cancellation تعاونية ومش Rollback لأثر خارجي تم.
لو محتاج Deadline محلية، Linked source تجمع إلغاء Request مع CancelAfter، وتتخلص منها بعد انتهاء الاستخدام.
It's a cooperative cancellation signal created by a CancellationTokenSource. Code receiving it checks it or passes it to that support it, which throw OperationCanceledException when it fires. In , actions receive a that cancels when the client disconnects, and I flow it through and HttpClient calls. For timeouts I create a linked source with CancelAfter.
Entity Framework Core
36.49How does optimistic concurrency work in EF Core?Mid
الـ Concurrency الأصلية تدخل شرط WHERE وقت الحفظ. لو الصف اتغير ومفيش Row مطابقة، ترمي DbUpdateConcurrencyException بدل Overwrite صامت.
rowversion في Server مثال مولد من Database ومش وقتًا. اختار Reload أو Merge أو إعادة طلب قرار المستخدم حسب المعنى؛ Blind retry بنفس القيم مش علاجًا.
I configure a concurrency , such as Server rowversion or an application-managed version. remembers the original value and includes it with the key in update and delete predicates. If another writer changes that version, the expected row is not affected and EF raises DbUpdateConcurrencyException. I then return a conflict or reload and reconcile according to business rules. I do not blindly retry a user edit, because that could overwrite the newer decision.
Data Consistency و Transactions
36.50How would you prevent overselling the last product?Mid
تحقق إن الكمية موجبة، ثم UPDATE تقلل Stock بشرط إنها كافية.
لازم Rows affected تكون واحدة؛ الصفر فشل حجز مش نجاح. لو فيه Insert لـ Order معها، جمعهم في نفس . Atomic statement تمنع فجوة Read-modify-write، و Constraint ممكن تضيف دفاعًا إضافيًا للقاعدة.
I validate that the requested quantity is positive and issue a conditional UPDATE that subtracts it only where the product has enough stock. I treat one affected row as a successful reservation and zero as failure. If creating the order must be atomic with reservation, both operations share a . This works across application instances because the database coordinates the write. I also add suitable constraints and a reservation identity if retries must not reserve the same order twice.
ASP.NET Core و MVC
36.51What is CORS preflight, and does CORS secure an API?Mid
Browser قد تبعت OPTIONS قبل الطلب الفعلي تسأل عن Origin و Method و Headers المسموحة.
تحدد سماح JavaScript بقراءة الرد عبر Origins، لكنها لا تمنع curl ولا تستبدل Authorization أو حماية . راجع Allow credentials و Origins المحددة؛ نجاح Preflight مش معناه إن المستخدم يملك الـ Order.
A browser sends a preflight OPTIONS request for cross-origin requests that need permission for their method or headers, such as requests with Authorization. answers according to the allowed origins, methods and headers. It is a browser-enforced sharing policy, not server authentication, authorization or protection, and tools such as curl do not enforce it. I allow explicit origins and never combine wildcard origins with credentialed access.
Security
36.52What is CSRF and does CORS prevent it?Mid
موقع مهاجم يستغل cookie بتتبعت تلقائياً. Antiforgery للـ unsafe requests، و SameSite، و GET من غير mutations. مش منع كامل لإرسال الطلب.
CORS بتحكم إتاحة قراءة الرد في المتصفح، ومش بتمنع كل إرسال لطلب Cross-site. طلبات تغيير الحالة باعتماد Cookie محتاجة Antiforgery وسياسة SameSite مناسبة، و GET ماتعملش تغيير Business مقصود.
I consider when the browser automatically attaches credentials, especially session cookies. An attacker can cause a victim's browser to submit a state-changing request without reading its response. I validate antiforgery , use suitable SameSite settings and avoid state changes through GET. governs cross-origin browser access but is not a complete CSRF defense, since some requests can still be sent. Explicit bearer headers change the threat model, while storing that bearer token in a cookie restores automatic attachment.
Caching و Redis
36.53What is a cache stampede?Mid
Hot key غابت فجأة وطلبات كتير حملت الأصل. Single-flight و bounded refresh يقللوا الحمل؛ jitter مفيدة لانتهاء مفاتيح كتير لكنها مش حل كامل لنفس key.
مثلًا Expiry لسعر مشهور تشغّل مئات Queries مرة واحدة. خلي المنتظرين يشاركوا تحميلًا واحدًا وحدد عدد قراءات المصدر وقت Cold Cache.
I call it a when many requests miss the same popular entry and all recompute it together. I use single-flight loading to share that work, with refresh-ahead or bounded stale-while-revalidate where the business permits it. HybridCache coordinates loads locally, so I still account for multiple instances. jitter helps distribute different keys' expirations but does not alone prevent a burst against one missing key. I also bound origin concurrency to survive cold starts.
Async و Multithreading
36.54What is the difference between Task.WhenAll and Task.WhenAny?Mid
ابدأ عمليات مستقلة ثم WhenAll لانتظار اكتمالها كلها؛ لو شغلتها معًا فالوقت مرتبط بأبطأ واحدة وبحدود الموارد، مش مجموعها عادةً.
WhenAny ترجع Task الأولى اكتمالًا، وقد تكون فشلت. لازم تنتظرها لمعالجة نتيجتها، والباقي لا يتلغى تلقائيًا؛ حدد إلغاءه أو متابعة أخطائه.
Task.WhenAll completes when all tasks complete, so independent operations take about as long as the slowest one; awaiting it rethrows the first exception while the task's Exception holds all of them. Task.WhenAny completes when the first task completes and returns that task without throwing, so you await it to get its result. I use WhenAll to run independent calls concurrently, and WaitAsync or WhenAny for timeouts.
LINQ و Collections
36.55What is deferred execution, and is every deferred operator streaming?Mid
تعني إن الشغل يتأجل لوقت Enumeration، و Streaming تعني إن أول نتيجة ممكن تظهر من غير قراءة المصدر كله.
Where غالبًا تقدر تنتج بالتدريج، لكن OrderBy مؤجلة ومع ذلك محتاجة Buffer للعناصر قبل ترتيبها. فرق بين موعد التنفيذ وحجم البيانات المطلوبة لبدئه؛ الاتنين مش نفس الخاصية.
means constructing a query does not immediately process its source. Enumeration or a terminal operator triggers the work. It does not necessarily mean streaming: Where and Select can yield progressively, while -to-Objects OrderBy must buffer before producing sorted results. I consider both timing and memory behavior. Re-enumerating can repeat expensive work or see changed data, so I a reasonably sized result when I need a stable, reusable snapshot.
SQL وقواعد البيانات
36.56What are ACID properties, and do they enforce business rules automatically?Mid
تصف Atomicity و Consistency و و Durability، لكنها لا تكتب قواعد البيزنس بدل التطبيق.
تضم Order وخصم Stock، ومع ذلك ممكن Read-modify-write خاطئة تكسر القاعدة حسب العزل. اكتب وحققها بـ Constraints أو Atomic conditional update أو Concurrency مناسبة؛ وجود BeginTransaction وحده مش إثبات للصحة.
I describe atomicity as all-or-nothing changes, consistency as preserving valid states, as controlling interference between , and durability as retaining committed results under the configured guarantees. A transaction does not invent business rules: constraints and correct operations still need to enforce them. For stock, I may use a conditional update or suitable concurrency control. I also keep remote payments outside the assumption that a local database transaction can roll everything back.
Messaging و Distributed Systems
36.57How do consumer acknowledgments differ from publisher confirms?Mid
Confirm من للناشر عن قبول الرسالة. Ack من consumer للـ broker بعد المعالجة. بينهم مراحل وفشل محتمل، ومفيش واحد بيغني عن التاني.
ممكن Confirm تنجح وبعدها Consumer تقع قبل الحفظ؛ Publisher عنده دليل النشر بس، ولسه ضمان المعالجة محتاج Ack وتصميم يتحمل التكرار.
I use publisher confirms to know that the accepted responsibility for a published message under its configured durability rules. Consumer acknowledgments report successful handling of a delivery and let the broker remove it from the queue. They protect different stages and neither replaces the other. I acknowledge only after committing the business effect. If the consumer crashes between commit and acknowledgment, the message can return, so I design for duplicates even when every publisher uses confirmations.
C# الأساسيات و OOP
36.58What is a record? How is it different from a class?Mid
لو مبلغين بنفس Amount و Currency المفروض يتقارنوا كقيمة، record توفر Equality مولدة و ToString و with.
لكن with تعمل Shallow copy: لو جوه النوع List، النسخة ممكن تشاركها. record class نوع Reference، و record struct نوع Value؛ و record وحدها مش ضمان Deep أو صحة البيانات.
A record generates value equality, a useful ToString, and a shallow non-destructive copy with with. Positional record classes have init-only properties; positional record structs are mutable unless declared readonly. Records can also contain mutable members, so they aren't automatically . I use records for , messages and value objects, and classes for entities with identity and behavior. See the official record reference.
Async و Multithreading
36.59What are the most common async/await mistakes?Mid
لو Request رجعت قبل Fire-and-forget تكمل، الـ Scope ممكن تكون اتقفلت؛ ولو شغلت عمليتين على نفس فقد استخدمتها بشكل غير آمن.
راجع كمان .Result و.Wait و async void ونسيان await و CancellationToken. و lock لا تسمح بـ await داخلها؛ استخدم تنظيمًا يدعم الانتظار غير المتزامن حسب نطاق المشاركة.
Common mistakes include blocking with .Result or .Wait, which can cause a when completion needs an occupied constrained context, or ThreadPool starvation under load. has no custom SynchronizationContext by default, but that does not exclude other deadlocks. Other mistakes are async void outside event-handler signatures, leaving returned Tasks unobserved so failures may go unnoticed, and unowned fire-and-forget work that may outlive the request's scope. Also avoid concurrent operations on one and trying to await inside a lock statement; propagate CancellationToken to operations that support cooperative cancellation.
ASP.NET Core و MVC
36.60Why use IHttpClientFactory, and what is a valid alternative?Mid
IHttpClientFactory تعيد استخدام Handlers وتجمع Configuration و Logging وسياسات الاتصال.
بديل مناسب Client طويلة العمر مع SocketsHttpHandler و PooledConnectionLifetime حسب احتياج والاتصالات. المشكلة الشائعة إنشاء Handler جديدة لكل Call، مش مجرد وجود new HttpClient في صياغة بعينها. راقب Lifetime الفعلية وحدود الموارد.
IHttpClientFactory centralizes configuration and pools handlers so short-lived clients can reuse connections without rebuilding a connection pool for every call. Typed clients also give a focused application boundary. A long-lived HttpClient using SocketsHttpHandler with a suitable PooledConnectionLifetime is a valid alternative. I avoid claiming that every static client is wrong. I check refresh, cancellation, timeouts and lifetime capture, especially when a singleton holds a typed client intended to be short-lived.
Web APIs و REST و gRPC
36.61When would you use cursor pagination instead of offset?Mid
Feed كبيرة ومتغيرة تستفيد من Cursor تكمل بعد آخر Sort keys بترتيب فريد و Index مناسبة.
Offset أسهل للقفز لصفحة برقم، لكن الصفحات البعيدة والإضافات المتزامنة قد تزيد كلفتها وتغير عضويتها. Cursor مش Snapshot تلقائيًا، ولا بديل للتحقق من نطاق القراءة في كل Request.
I use offset for small administrative lists and direct access to numbered pages. For large feeds, cursor pagination avoids traversing a growing number of skipped rows. I use a deterministic sort, such as creation time plus a unique numeric identifier, and a matching index. The cursor captures both values and is tied to the filters. It reduces insert-related paging problems but does not create snapshot consistency when records themselves change, and arbitrary page jumps become harder.
Testing
36.62Why avoid EF Core InMemory for database tests?Mid
مش relational ومش بيختبر translation أو أو constraints الحقيقية. SQLite ليه اختلافاته برضه؛ المطلوب engine مطابق للـ production.
Unique Constraint و Transaction ممكن يختلفوا بين Providers. لو دي المخاطرة اللي بتختبرها، لازم Engine تمثل بيئة التشغيل بدل بديل بيعدّي لنفس أسماء بس.
I do not use InMemory to prove database correctness because it is not a relational engine. Passing tests cannot establish correct translation, foreign-key behavior or . SQLite is relational but still differs from SQL Server or PostgreSQL in dialect, types and comparison behavior. I test important queries and concurrency rules against the production database engine in disposable infrastructure, and use stubs above data access when a focused unit test needs predefined results.
Logging و Observability
36.63What does OpenTelemetry do in a .NET application?Mid
Standard و و exporters. ActivitySource و Meter من ، و نقل. Dashboard و storage بييجوا من backend.
إضافة Exporter بتحدد النقل، لكنها مش بتختار Retention أو تعمل Alerts. لازم تتأكد إن المصادر المطلوبة متسجلة وإن Backend فعلًا بتستقبل البيانات وتعرضها.
I use OpenTelemetry to collect and export telemetry through standard and configurable pipelines. In , ActivitySource and Activity represent , while Meter produces measurements. I register the relevant sources and meters, configure and resources, and export through to a collector or backend. Logs have their own pipeline. OpenTelemetry is not itself a storage database or dashboard, and changing backends can still require configuration and semantic adjustments even when application instrumentation stays the same.
Docker و CI/CD و Git
36.64What makes a good .NET Dockerfile?Mid
multi-stage، و restore cache، و runtime-only final image، و non-root، و.dockerignore، و secrets برّه الصورة.
نسخ ملفات Projects قبل باقي الكود يسمح بإعادة استخدام Restore Layer لما Dependencies ماتتغيرش. راجع Solution References قبل نقل مثال المشروع الواحد.
I use an stage to restore and publish, then copy only published output into an ASP.NET runtime stage. I copy dependency inputs before source to preserve restore caching, run as a non-root user and exclude build output and secrets from the context. I consider chiseled images when their missing shell and package tools fit the application. I pin release inputs, scan and update images, and verify globalization, filesystem permissions and shutdown behavior.
الـ AI في .NET: RAG و Embeddings و MCP
36.65Walk me through a RAG pipeline.Mid
قبل السؤال، Ingestion تطلع النص وتقسمه وتولد وتحفظ Metadata والمصدر والنسخة والصلاحيات.
وقت السؤال نتحقق من Identity ونعمل Retrieval لأدلة مسموحة، ونرتبها ونبني Context محدودة ونولد ردًا بمصادر. نقيس جودة البحث والرد منفصلين؛ ممكن ترجع دليلًا غلط أو الـ Model تستنتج منه كلامًا غير مدعوم.
I separate ingestion from answering. Ingestion extracts and chunks documents, creates and stores source versions and access metadata. At request time I authenticate the user, retrieve authorized candidates with keyword and vector search, optionally rerank them and construct a . The model answers from that evidence with source identifiers and abstains when support is missing. I validate citations and evaluate retrieval recall separately from answer groundedness, while tracking , cost and deletion freshness.
الـ AI في .NET: RAG و Embeddings و MCP
36.66What does an embedding represent?Mid
هي Vector أرقام تساعدنا نقارن التشابه بين نصوص حسب الـ Model اللي أنتجتها.
السؤال والمستندات لازم يكونوا في Vector Space متوافقة؛ نفس عدد الأبعاد مش كفاية. القرب مش احتمال إن النص صحيح، وكل Dimension مش حقل Business ثابت نقدر نسميه سعر أو اسم.
I use as numerical representations for comparing content, often semantic similarity. I generate document and query vectors with the same compatible model and configuration, then compare them using the store's supported distance metric. Cosine compares directions and needs nonzero vectors. A high similarity score is not a probability that an answer is true. I calibrate relevance on labeled examples and rebuild the index when a model change makes the old vector space incompatible.
SOLID و Architecture
36.67What distinguishes Clean, Hexagonal and Onion architecture?Mid
لو Domain محتاجة عشان تختبر قواعدها، اسأل إزاي تعزلها عن الخارج.
Clean بتوضح Domain و Use Cases ، و Hexagonal بتبرز Ports و Adapters ، و Onion بتضع Domain في المركز.
الفكرة المشتركة حماية القلب، ومش لازم كل مشروع يكرر نفس عدد الطبقات.
I see them as related approaches to protecting the application core. Clean Architecture emphasizes entities, use cases and inward source dependencies. Hexagonal Architecture emphasizes inbound and outbound ports with replaceable adapters. Onion Architecture places the domain at the center of dependency rings. Their vocabulary differs, but all can keep and persistence details outside core policy. I choose the boundaries needed by the application rather than adding every named layer from a diagram.
Messaging و Distributed Systems
36.68How do retry, timeout, circuit breaker and bulkhead work together?Mid
Retry للمؤقت بميزانية و jitter، و timeout لكل attempt وللإجمالي. Breaker يوقف النداءات فترة، و bulkhead يحد concurrency. راقب multiplication
لو كل طبقة بتعيد. لو كل طبقة بتجرب ثلاث مرات، المحاولة الأصلية ممكن تضرب الخدمة مرات أكتر بكتير. حدد ميزانية إجمالية و للعمليات المؤثرة قبل إضافة Retry.
I give the operation a total time budget, bound each attempt, and retry only transient failures where repeating the effect is safe. Exponential backoff with jitter prevents synchronized retry bursts. A circuit breaker rejects calls temporarily when a dependency is failing, then admits probes during recovery. A bulkhead limits concurrent work so one dependency cannot consume all capacity. In I can configure the standard resilience handler, while avoiding layered retry multiplication and treating consumer retries as a separate policy.
System Design
36.69How do you begin a system design interview?Mid
أوضح الـ Scope والمستخدمين والـ Functional Requirements والـ Non-goals، وبعدها Load و وAvailability وConsistency.
أكتب افتراضات وأقدر الأرقام وأعرف وData Model والـ . بعدها أرسم أبسط تدفق وأختبر أصعب جزء؛ Cache و تتضاف لسبب محدد.
I begin by clarifying the user journeys and explicit non-goals, then ask about peak traffic, data volume, , availability and consistency requirements. I state assumptions when numbers are missing and estimate the scale before choosing components. Next I define the main , data model and , draw a simple baseline and explore the hardest part. I finish by testing failure scenarios and explaining how measurements would justify scaling or changing the design.
System Design
36.70What happens if the payment provider times out?Senior
أتعامل مع النتيجة Unknown، لأن الدفع ممكن يكون تم والرد ضاع.
أستخدم Key ثابتة حسب العقد، وأراجع Status أو Webhook مع Reconciliation. لازم أحدد كمان إزاي Late Success تتنسق مع Reservation انتهت؛ إعادة Charge بمفتاح جديد ممكن تضاعف الدفع.
I treat the outcome as unknown because the provider may have charged successfully before the response was lost. I persist the attempt and use the provider's mechanism for safe retries, then resolve the outcome through verified webhooks or reconciliation. The order remains in an explicit intermediate state. I also define what happens if stock reservation expires before payment confirmation, such as re-reservation or refund. A database rollback cannot undo a charge in an external system.
SOLID و Architecture
36.71When would you choose a modular monolith over microservices?Senior
لو Deploy واحدة مناسبة ومش محتاج استقلال تشغيل لكل جزء، Modular Monolith بتدي حدود ملكية وعقود من غير Network.
Microservices تستحق النقاش لما استقلال Scaling أو Release أو Teams له قيمة فعلية.
قارن المكسب بتكلفة الاتصالات والأعطال والبيانات الموزعة قبل الفصل.
I choose a modular monolith when one deployment is acceptable and clear module ownership gives most of the needed separation. It keeps local calls and makes shared transactional work easier to coordinate. Microservices become attractive when independent deployment, scaling or team ownership provides a measurable benefit worth network and operational complexity. I enforce contracts and data ownership from the start, but I do not promise that extracting a module later is trivial; migration and distributed failure handling still require design.
Security
36.72How do you prevent cross-tenant data leakage?Senior
Tenant موثوق، و queries و writes scoped، و policies و cache و files و messages معزولة. اختبر tenant A ضد IDs بتاعة B، بما فيها admin و raw .
Cache Key فيها Tenant مش كفاية لو Query نفسها مش Scoped. راجع نفس العزل في Export والملفات والرسائل ومسارات Admin عشان التسريب ممكن يحصل من طريق جانبي.
I establish tenant identity from a trusted authenticated context and authorize any tenant selection. Queries and writes remain tenant-scoped, with resource checks where needed. I extend to cache keys, storage paths, exports and message handlers. Database filters help, but raw , administrative bypasses and unfiltered relationships still require review. I add tests where one tenant supplies another tenant's identifiers, including update and bulk paths, because an unpredictable identifier alone is not an access-control boundary.
Entity Framework Core
36.73How do you deploy migrations safely during rolling releases?Senior
استخدم Script أو Bundle متراجعة وخطوة تنفيذ متحكم فيها.
Expand-contract تضيف المتوافق، وتجهز Backfill وتبديل القراء والكتاب، ثم تشيل القديم بعد خروج كل المستهلكين. Migration lock تمنع بعض السباقات لكنها لا تمنع كسر نسخة قديمة؛ التوافق أثناء Rolling release قرار تصميم إضافي.
I review a generated script or bundle and run it as a controlled deployment step with dedicated privileges. I test locking, duration, data conversion and recovery on realistic volumes. For incompatible changes I expand the , deploy compatible code, retire old writers, backfill safely, switch reads and contract later. Migration locking can reduce simultaneous execution, but does not make a destructive change compatible with old instances. I keep clear migration ownership and a forward-repair plan.
Messaging و Distributed Systems
36.74How do you implement an idempotent consumer safely?Senior
Unique consumer و message ID في inbox، مع effect في نفس . Check قبل insert مش كفاية مع concurrent deliveries، والخدمات الخارجية محتاجة key خاص بيها.
نسختان متزامنتان ممكن يعدّوا فحص الوجود قبل الإدخال؛ Unique Constraint هي اللي تحسم السباق، مع حفظ الأثر المحلي في نفس Transaction.
I enforce a unique consumer-and-message key in an inbox and commit that record with the database effect in one . The unique constraint handles concurrent duplicates; a preliminary existence check alone is insufficient. I acknowledge only after commit, and distinguish the expected duplicate-key case from other database failures. External effects need their own contract or another durable delivery step, because a transaction cannot roll back a payment . I retain deduplication records for the supported replay window.
Logging و Observability
36.75How do you investigate a production performance incident?Senior
Impact و mitigation، بعدين metrics و و logs، واختبار hypothesis بأداة مناسبة، و fix بـ regression و rollout ومراجعة أسباب من غير لوم.
Hypothesis زي «الـ مصدر البطء» محتاجة Profile يدعمها أو يرفضها. ماتجمعش Dumps عشوائيًا؛ حدد السؤال والأثر الأول، وقِس نفس المؤشر بعد الإصلاح.
I establish the affected users, timing and severity, then mitigate safely through rollback or when needed. Metrics narrow the endpoint, version and resource pattern; show the critical path, and correlated logs add details. I choose diagnostics based on a hypothesis: counters for trends, a bounded trace for sampled execution, or a dump for retained objects and stacks. I reproduce the issue, add a regression test, roll out gradually and document contributing factors with owned follow-up actions.
Testing
36.76How would you test two buyers competing for the last item?Senior
database حقيقية، و context مستقل لكل محاولة، وتنسيق بداية، و assert على : نجاح واحد ومخزون مش سالب. جرّب retry كمان.
الـ Assertion الأساسية إن قطعة واحدة ماتتباعش مرتين؛ مش إن اتنين Tasks بدأوا. كرر مع جداول تنفيذ مختلفة وراجع نتيجة الخاسر و ، لأن التكرار مش إثبات لكل تداخل ممكن.
I seed one item in the real database engine and run two purchase attempts with independent contexts and . I coordinate their execution so they can reach the contested operation together, then assert one successful reservation, an expected failure for the other and nonnegative persisted stock. I also test retry and behavior. Repeated runs help expose scheduling problems, but the underlying atomic update or concurrency constraint must enforce the in production.
Async و Multithreading
36.77What is thread pool starvation and how do you detect it?Senior
لو و Queue length بيزيدوا مع مشغولة قليل، افحص هل ThreadPool workers محجوزة بانتظار .Result أو Blocking . Runtime ممكن تزود Threads لكنها مش حل مجاني لكل ضغط.
dotnet-counters و تساعد تربط الطابور بمواقع الحجز؛ الإصلاح يعالج السبب وحدود التزامن، مش مجرد رفع الحد الأدنى بلا قياس.
It happens when pool threads are blocked, typically by sync-over-async code, so queued work waits while the pool slowly injects new threads. explodes while stays low. dotnet-counters shows a growing thread-pool queue length and thread count. The fix is making the call chain async all the way down, not raising the minimum thread count.
Behavioral و Career
36.78Tell me about a time you showed leadership without authority.Senior
اختار موقفًا نسقت فيه شغلًا أو وضحت قرارًا من غير سلطة رسمية.
اشرح إزاي حددت المشكلة واحترمت مسؤوليات الناس واتفقتوا على متابعة. مثال Incident هنا للتدريب؛ خليك دقيقًا في مساهمتك ودور الفريق بدل ادعاء إنك أنقذت كل حاجة لوحدك.
During a service issue, several people were investigating overlapping areas while support needed an update. I was not the incident lead, so I suggested a shared timeline and asked who would coordinate decisions. I took ownership of one investigation path, posted evidence and helped separate mitigation from root-cause work. After recovery, I organized the follow-up actions with named owners. The useful contribution was reducing confusion and helping others act effectively, rather than taking over decisions that were not mine.
LINQ و Collections
36.79How would you design stable pagination for a large changing order list?Senior
ابدأ بترتيب فريد، زي CreatedAt ثم Id، وخلي الـ Cursor تحمل كل Sort keys اللازمة. Index مناسبة تساعد Query تكمل من المكان ده بدل Offset كبيرة.
Keyset تقلل مشكلات الإزاحة مع Inserts، لكنها مش Snapshot لتاريخ ثابت، وتغيير Sort keys أثناء التصفح ممكن يظل يغير ما يظهر.
I use a deterministic ordering, for example CreatedAt followed by a unique numeric Id, with a matching index. A keyset cursor carries both values and the next-page predicate compares them lexicographically in the same sort direction. This avoids deep offset scans and many shifts caused by new rows. The trade-off is harder random page access. I also define behavior when sort keys change, because a cursor does not provide snapshot across separate requests.
SQL وقواعد البيانات
36.80How do you optimize a slow query without guessing?Senior
ابدأ بـ Actual execution plan و Logical reads و Waits و Parameters الحقيقية، وقارن وقت Database بالنقل والتطبيق.
Scan على جدول صغير أو Range كبيرة ممكن تكون منطقية، و Seek مع Lookups كثيرة ممكن تظل مكلفة. اختبر تعديلًا يخدم سببًا محددًا، ثم قارن نفس الناتج والحمل بدل إضافة Hint بالتخمين.
I capture the query, parameters, duration, logical reads and waits, then inspect its actual execution plan. I compare estimated and actual rows, look for spills, expensive lookups, large transfers and blocking, and check statistics. I reduce unnecessary data and round trips, rewrite predicates or adjust indexes according to evidence. I test different parameter sizes and compare before and after, including write impact. A scan is not automatically bad, and a seek is not automatically cheap.
SOLID و Architecture
36.81Does CQRS require separate databases, MediatR or event sourcing?Senior
قائمة Orders محتاجة خفيفة وإنشاء Order محتاج قواعد كتابة؛ فصل المسارين ده كفاية لبدء على نفس Database.
MediatR و مش شروط.
Read Store منفصلة بتضيف Lag ومزامنة، بينما Event Sourcing قرار مختلف عن جعل الأحداث مصدر الحقيقة.
No. I can separate command behavior and query projections while using one database and injecting handlers directly. A separate read store is useful for independent read shaping or scaling, but introduces propagation lag, rebuilds and operational work. is another decision about making events the authoritative history rather than storing only current state. MediatR is one dispatch implementation. I introduce each choice for a concrete requirement instead of adopting a whole bundle because it is labeled .
Data Consistency و Transactions
36.82Why can snapshot isolation allow write skew?Senior
دكتورين قرأوا Snapshot فيها الاتنين On-call، وكل واحد عدل صفه إلى Off-call.
لأن الصفين مختلفين، مفيش Same-row conflict تمسكها Version لكل صف، ومع ذلك شرط وجود دكتور اتكسر. Serializable مع Retry أو Lock لمورد مشترك قبل القرار ممكن تحمي القاعدة؛ Snapshot وحدها لا تثبتها.
Snapshot gives a consistent view but does not necessarily protect every predicate used in a decision. Two doctors can each observe that two people are on call, then update different rows to leave. Neither overwrites the other, yet nobody remains. A rowversion on each doctor does not fix that. I use Serializable with whole- retries or serialize the decision through a shared roster row locked before checking the count. The protected boundary must match the business .
Messaging و Distributed Systems
36.83Can you guarantee exactly-once processing?Senior
حدد النطاق الأول. Kafka ليها ضمانات داخل Kafka؛ مش معناها دفع خارجي مرة واحدة. غالباً at-least-once مع inbox و effects.
نجاح Transaction داخل مش معناها إن Payment الخارجية داخلة معاها. اربط Idempotency Key بنفس نية العملية عشان Retry مايبقاش دفع جديد.
I first define the boundary of the guarantee. A platform can provide exactly-once semantics within a specific scope, such as Kafka records and offsets, without covering a separate database or external payment provider. For a cross-system workflow, I usually combine at-least-once delivery with atomic inbox processing, unique business keys and provider keys. I describe the remaining failure windows explicitly and add reconciliation, rather than claiming that a option makes every business effect happen exactly once.
Caching و Redis
36.84How do you know a cache is helping and can survive an outage?Senior
Hit ratio مع و origin load و evictions و errors، واختبارات cold و outage. Fallback غير محدود ممكن يوقع الـ .
Hit Ratio عالية ممكن تخفي Misses غالية. قارن زمن الطلب كامل وحمل Database ، ثم اقطع Cache وشوف هل Timeouts وحدود Fallback حافظوا على الخدمة.
I compare end-to-end and origin load before and after caching, alongside hit ratio, evictions, payload sizes and cache errors. I separate local and distributed hits because their costs differ. Then I exercise cold starts, unavailable Redis and failed invalidation. Fallback must have timeouts and bounded database concurrency; otherwise a cache outage can become a database outage. I define whether each endpoint may serve bounded stale data, degrade its response or fail safely under those conditions.
System Design
36.85How do you choose a multi-tenancy model?Senior
أقارن درجة العزل والـ Tenant Count وتكلفة التشغيل والـ Restore والترحيل.
Shared Database مع TenantId أقل تكلفة غالبًا، لكنها تحتاج Filters وConstraints وربما ، اختصار Row-Level Security. Database لكل Tenant تسهل بعض العزل والاستعادة وتزود Provisioning وConnections وMigrations؛ القرار يعتمد على متطلبات العملاء.
I compare requirements, tenant count, workload variation, compliance needs and operational cost. A shared database is economical but needs reliable tenant filtering, scoped constraints and controls against noisy neighbors. Separate databases simplify some restore and movement scenarios at the cost of provisioning and migration management. A hybrid model can dedicate large tenants. I also scope caches, jobs and rate limits, and distinguish data isolation from compute isolation because separate databases can still share a server.
Docker و CI/CD و Git
36.86How do you deploy a breaking database change safely?Senior
expand ثم backfill وتحويل تدريجي، وبعد خروج القديم وانتهاء rollback window اعمل contract.
ضيف Column الجديدة واسمح للقديم والجديد يشتغلوا معًا قبل نقل الاستخدام. حذف القديم يتأجل لبعد نافذة الرجوع عشان Rollback تفضل ممكنة.
I use expand and contract so old and new application versions can coexist. I first add compatible , deploy code that tolerates both representations, backfill in resumable batches and switch reads after verification. I remove the old structure only after old instances and the rollback window are gone. I run migrations through one controlled job and test lock behavior on realistic data. Reverting the application image cannot restore deleted data, so recovery needs separate planning.
Security
36.87How do you verify a payment webhook safely?Senior
تحقق من Signature على Raw Bytes حسب عقد Provider، و constant-time comparison، و timestamp موقعة لمنع replay، و event ID unique، وبعدها amount و currency و order من المصدر.
التحقق بيتم على Raw Bytes المستلمة حسب عقد المزود، مش إعادة ترتيب وتوقيع نسخة مختلفة. بعد صحة التوقيع لسه لازم تربط الحدث بالـ Order والمبلغ وتمنع تكرار الأثر.
I verify the provider's exact signature contract over the raw request bytes before , with bounded body size and constant-time comparison for valid signatures. I validate an authenticated timestamp where the protocol provides one and deduplicate event IDs atomically with processing. Then I compare the order, amount and currency against authoritative data and apply only valid state transitions. remains necessary, and I never treat a client redirect as payment proof. Failed deliveries need monitored retries and reconciliation.
Logging و Observability
36.88Explain SLIs, SLOs and error budgets.Senior
قياس معرف، و هدف خلال نافذة، و budget نسبة الفشل المسموحة. Request-based budget مش نفس downtime minutes، و burn rate يقيس سرعة الاستهلاك.
لو الهدف نجاح 99.9% من الطلبات، Budget مبنية على الطلبات في نافذة محددة مش عدد ساعات عطل تلقائيًا. Burn Rate بتقول بناكل الهامش بالسرعة قد إيه عشان ننبه قبل نفاده.
I define an as a measurement of service experience and an as its target over a specified window. The error budget is the allowed shortfall, such as the permitted fraction of failed eligible requests. I define eligibility, business success and the data source before calculating it. Burn rate compares observed failures with the sustainable budget rate. The budget then guides reliability priorities and deployment risk under an agreed policy, rather than becoming a number disconnected from user experience.
System Design
36.89What are backpressure and graceful degradation?Mid
تحد دخول شغل جديد لما التنفيذ مش لاحق بدل تراكم غير محدود.
Graceful Degradation توقف أو تخفف ميزة ثانوية علشان الوظيفة الأساسية تفضل شغالة. لازم Limits وسياسة ومقاييس واضحة؛ مثلًا نتأخر في Recommendations ونحافظ على Checkout مع رد مفهوم للمستخدم.
I use to make producers slow down or reject work when consumers cannot keep up. Bounded queues, concurrency limits and deadlines prevent an overload from turning into unbounded memory use and stale requests. Graceful degradation preserves essential behavior by reducing optional work, such as disabling recommendations while checkout remains available. I define these modes explicitly and monitor their impact. A growing queue without admission control only postpones failure, and a fallback must not silently violate payment or security .
Behavioral و Career
36.90How do you work with ambiguous requirements?Mid
لو الطلب «اسمح بالإلغاء»، أحوله لأمثلة: أنهي Order، مين له الحق، قبل الدفع ولا بعده، والمخزون يرجع إمتى؟
أوثق الافتراضات وأحدد صاحب القرار للسؤال المفتوح. أقدر أتقدم في جزء مستقل، لكن ما أحسمش قاعدة مالية غامضة وكأنها Requirement مؤكدة.
I turn ambiguity into explicit questions and examples. For an order-cancellation request, I would clarify allowed states, ownership, stock release and what happens if payment succeeds concurrently. I write a short acceptance example and confirm it with the decision owner. If an answer is delayed, I separate reversible technical work from decisions that could change money or customer behavior. I record provisional assumptions and a review date rather than letting my interpretation become an undocumented business rule.
Data Consistency و Transactions
36.91How would you guarantee read-your-writes with replicas?Senior
بعد الكتابة، اقرأ Primary أو اربط القراءة بـ position وانتظر Replica تلحقها وفق دعم النظام.
تثبيت العميل على Primary لثانيتين مجرد تخمين لو Lag ممكن تطول بلا حد معلوم. Read-your-writes ضمان جلسة لازم ينعكس في Routing والسياق، مش مجرد وجود Replicas.
I first define the scope of the guarantee, usually a user session. The straightforward solution is to route that session's relevant reads to the primary. Another option is a commit-position and a replica that waits until it has applied at least that position before serving the read. I would not call a fixed two-second sticky window a guarantee unless lag has a proven bound. I also make sure caches do not reintroduce older results.
Messaging و Distributed Systems
36.92What is a saga, and how do choreography and orchestration differ?Senior
Saga بتتبع local وتعويضات. Choreography أحداث موزعة، و orchestration منسق stateful. التعويض نفسه ممكن يفشل، ومفيش تلقائي.
Refund مش مسح للدفع؛ عملية جديدة لها سجل وفشل محتمل. لازم Saga تحتفظ بالتقدم وتقدر تستكمل بعد Restart وتوضح الحالات اللي محتاجة تدخل.
I use a saga for a long-running workflow across boundaries, with local commits and compensating actions. Choreography lets participants react to events, while orchestration uses a coordinator to persist progress and issue commands. I prefer explicit orchestration when timeouts and recovery make the flow difficult to understand through events alone. Compensations are business actions that can fail and need and monitoring. A saga also does not provide , so reservations and pending states remain important.
Entity Framework Core
36.93How do explicit transactions interact with connection retries?Senior
لو Execution strategy هتعيد Connection failure، لف الـ الصريحة كلها داخل وحدة التنفيذ القابلة للإعادة.
استخدم Context مناسبة وحالة نظيفة، واحمِ الآثار الخارجية بـ . فشل الاتصال أثناء Commit ممكن يترك النتيجة غير معروفة؛ تحقق بدل افتراض إن Rollback حصل وإن إعادة الدفع آمنة.
I run the whole inside the execution strategy so a transient failure can replay a complete unit. I create fresh context state for each attempt and keep external side effects out of the retry , using an where needed. I also consider commit ambiguity: a connection failure during commit does not prove rollback. Operations need or outcome verification. I avoid broad retries for business conflicts and choose according to the actual .
HTTP و Networking
36.94How does HttpClient react to DNS changes?Senior
بيتحل عند إنشاء connection، مش كل request حسب . lifetime أو handler rotation يسمحوا باتصالات جديدة؛ القديمة مش بتتقفل فور تغيير DNS.
لو Client ماسكة Connection قديمة، TTL قليلة مش هتنقل الطلب فورًا. PooledConnectionLifetime أو Handler Rotation تسمح باتصالات جديدة حسب السياسة.
I assume is resolved when a connection is established rather than before every request. Existing pooled connections can continue using the old destination after records change. PooledConnectionLifetime or suitable handler rotation allows new connections to resolve again, with an interval chosen for the environment. I also avoid indefinitely retaining factory clients when relying on rotation. Lowering DNS alone does not move traffic already traveling through an established connection.
System Design
36.95How would you build a global rate limiter?Mid
أحدد Quota وBurst ومفتاحها: Tenant أو مستخدم أو Endpoint حسب الغرض.
على كذا Instance، أستخدم Gateway أو Distributed State بتحديث ذري. الـ In-memory Limiter بتطبق حدًا محليًا فقط؛ وأحدد Fail-open أو Fail-closed عند تعطل الحالة بناء على أثر الرفض وأثر تجاوز الحد.
I first define the partition key, sustained rate, allowed burst and whether the quota must be global. A bucket is useful when bounded bursts are acceptable. For several instances, I place enforcement at a gateway or use shared state with atomic refill-and-consume operations; independent local counters multiply the effective limit. I bound key and waiting, return useful rejection information, and define fallback behavior if the shared counter fails according to endpoint risk.
Testing
36.96How do contract tests differ from E2E tests?Senior
contract بيثبت اتفاق consumer و provider عند boundary، والـ بيثبت رحلة متوصلة. لوحده مش بيغطي كل semantics.
تغيير اسم Field قد ينكشف في Contract أسرع من رحلة كاملة. لكن نجاح العقد مش دليل إن Checkout بين كل الخدمات شغالة؛ كل مستوى لازم يثبت وعده المحدد.
I use contract tests to verify an agreement at a service boundary, including the requests a consumer sends and the responses it requires. Provider verification checks the actual provider against that agreement. This gives faster, more focused compatibility feedback than a full environment. It does not prove the entire business workflow, authorization configuration or network routing. I retain selected tests for those interactions and avoid treating a matching as complete semantic compatibility.
الـ AI في .NET: RAG و Embeddings و MCP
36.97How do you secure multi-tenant RAG?Senior
Tenant لازم تيجي من هوية موثوقة على السيرفر، ومعاها Document داخل Retrieval قبل بناء الـ Context.
اعزل Cache Keys حسب Tenant والصلاحيات والنسخة، وتحقق تاني عند فتح Citation أو نداء Tool. اختبر حذف مستند وتغيير الصلاحيات؛ لو النص الممنوع وصل للـ Model، Prompt تطلب كتمانه مش ضمان للعزل.
I derive tenant context from authenticated server identity and enforce tenant and document permissions during retrieval. Unauthorized content must never enter the prompt. I isolate indexes where required, scope caches by tenant and access context, and reauthorize citation downloads and tool actions. Permission changes and deletions must invalidate stale evidence and cached answers. I test cross-tenant queries and cache reuse explicitly, and treat , logs and conversation history as sensitive data subject to the same retention controls.
الـ AI في .NET: RAG و Embeddings و MCP
36.98How would you evaluate a support assistant?Senior
أبني Evaluation Set بإجابات وأدلة مرجعية، تشمل العربي والإنجليزي ونقص الدليل والتعارض والهجمات.
أقيس Retrieval Recall وصحة الرد وGroundedness وصحة Citations والـ Abstention، مع اختبارات العزل والتكلفة والـ . المراجعة البشرية تضبط أدوات الحكم الآلية؛ نجاح أو انطباع إن الرد لطيف مش دليل كفاية.
I build a versioned evaluation set covering normal questions, missing evidence, conflicting policies, both supported languages and adversarial requests. I measure retrieval recall, answer correctness, groundedness, citation validity and appropriate abstention separately. I also test permission and tool safety as hard requirements. Human review calibrates automated judges rather than being replaced by them. I compare prompt and model versions on the same set, then monitor approved production samples alongside and cost per successful resolution.
C# الأساسيات و OOP
36.99Why is immutability useful?Mid
لو Object غير قابلة للتغيير بالكامل، مشاركتها تقلل مخاطر إن Thread تعدلها أثناء قراءة غيرها.
لكن record أو init وحدها مش ضمان إن List داخلية اتجمدت، ومش معناها إن كل النظام بقى خالي من Side effects. راجع الـ Object graph وملكية الـ References؛ خاصية للسلوك كله، مش Keyword واحدة.
objects can't change after creation, so they can be shared across threads without locks or , and they're easier to reason about and test because there are no hidden side effects. In C# I use records, init-only and required properties, readonly fields, and immutable or frozen collections.
Async و Multithreading
36.100What does ConfigureAwait(false) do, and do you need it in ASP.NET Core?Senior
ConfigureAwait(false) تطلب عدم محاولة الرجوع إلى Context الملتقطة للاستكمال. ده مفيد في Library عامة لا تحتاج context.
ما عندهاش SynchronizationContext افتراضي، فعادةً مفيش فرق من الناحية دي؛ لكن العبارة مش ضمان Thread مختلفة ولا علاجًا لكل Blocking أو .
For a Task await, ConfigureAwait(false) suppresses targeting the current SynchronizationContext or a non-default TaskScheduler for the continuation. It does not force a different thread; an already-completed await can continue synchronously. It can prevent some context-dependent caused by synchronous blocking, but is not a general deadlock cure. General-purpose library code commonly uses it when continuation code does not need the caller's context; -dependent code usually keeps that context. installs no custom SynchronizationContext by default, so application code usually does not need it for that reason, but custom contexts or schedulers can still be introduced.
System Design
36.101How do you estimate QPS and concurrent requests?Mid
أقسم العمليات اليومية على 86,400 للحصول على المتوسط، ثم أفصل Peak Factor وعدد Calls لكل عملية كافتراضات تحتاج بيانات.
QPS اختصار Queries Per Second. في نظام مستقر، Little’s Law تربط متوسط In-flight بمتوسط × Response Time؛ الوحدات لازم تتفق، والنتيجة مش تقدير Peak تلقائي.
I divide daily operations by 86,400 for an average rate, then apply an explicit peak assumption and account for multiple requests per business operation. I estimate storage separately, including indexes, retention, replicas and backups. For a stable boundary, Little's law gives average in-flight work as multiplied by average response time, including queue wait. These are sizing hypotheses rather than capacity guarantees, so I validate them with workload-shaped load tests and tail- measurements.
What does 0.1 + 0.2 == 0.3 return with double?
You override Equals on a class used as a Dictionary key. What else must you do?
Covariance (out T) allows...
What is the main benefit of async/await in an ASP.NET Core API?
A C# lock protects a stock counter, but the API runs on 4 instances. Is stock safe?
UPDATE ... WHERE Stock >= @qty.Best tool for CPU-bound work across cores?
What does AsEnumerable do by itself?
Which expression adds a secondary sort key?
Which collection suits a catalog built once and queried many times?
Which server receives requests in IIS in-process hosting?
What does CORS prevent by itself?
Which statement about durable schedulers is correct?
DELETE returns 204 first and 404 on retry. Is it necessarily non-idempotent?
What does AddOpenApi plus MapOpenApi provide?
A valid token lets customer A read customer B's order. What is missing?
Can two queries run concurrently on one DbContext?
A configured version changed since the entity was loaded. Saving normally raises...
What does DbContext pooling reuse?
LEFT JOIN followed by WHERE right.Total > 100 does what to unmatched rows?
Which date predicate is usually more sargable on CreatedAt?
What should follow deduplication once business identity is defined?
A reader observes a price that another transaction later rolls back. Which anomaly?
Which value should EF compare when saving an edited form?
Does a cache TTL by itself guarantee reads always return the latest committed value?
An invoice class changes for tax policy and email layout. Which principle is most directly involved?
Which DDD concept defines where Product has one consistent meaning?
What should an architecture decision record preserve?
A consumer commits a change and crashes before ack. What should you expect?
A RabbitMQ nack with requeue=false retains the failure when...
Which signal proves that the consumer completed its business effect?
Which layer shares serialized cached values across API instances?
Why is a tenant-aware cache key insufficient by itself?
Redis becomes unavailable. What protects the database?
A valid login can read another user's invoice by changing an ID. Which failure?
Why does an HttpOnly cookie not eliminate XSS risk?
A valid HMAC webhook is replayed tomorrow. What additional control matters?
Which signal follows one request through API, database and payment service?
A 99.9% request-success SLO permits how many failures per million eligible requests?
What makes an on-call page useful?
Which test best validates PostgreSQL query translation?
Why can transaction rollback fail to isolate an HTTP integration test?
A test fails only in parallel runs. Best first investigation?
What does a multi-stage Dockerfile keep out of the final image?
A bad commit is already shared on main. Which Git operation preserves history?
What should a proxy deployment do with forwarded headers?
Which sequence describes the TCP three-way handshake?
What does a 304 response normally omit?
What does lowering DNS TTL fail to do by itself?
Build a dictionary of m customers, then look up n orders. Expected total time?
What does a hash collision prove?
What does a lower-bound search return?
Best approach for 'longest substring without repeating characters'?
Top K frequent elements, efficiently?
Course Schedule (can all courses be finished?) is solved with...
What does a low temperature guarantee?
What is an MCP resource?
Where should a stdio MCP server write diagnostic logs?
What should happen before drawing architecture boxes?
Why can an outbox relay publish twice?
A queue grows indefinitely because arrival rate exceeds processing rate. What is needed?