All fields

“Exception Handling” in Information Technology

177 questions across 10 technologies.

Information Technology

177 questions in 10 technologies

#QuestionTechnologyTopicLevel
1How does exception handling interact with async/await, and how are exceptions from an async Task propagated to the awaiting caller? C# › Exception HandlingC#Exception HandlingAdvanced
2How would you design a robust global exception handling middleware in ASP.NET Core to convert unhandled exceptions into consistent API error responses? C# › Exception HandlingC#Exception HandlingAdvanced
3How does context manager __exit__ interact with exception handling, and how can it SUPPRESS an exception by returning True? Python › Exception HandlingPythonException HandlingAdvanced
4How would you implement a circuit breaker pattern using exception handling, to stop repeatedly calling a service that's consistently failing? Python › Exception HandlingPythonException HandlingAdvanced
5What happens by default in ASP.NET Core if you don't configure any global exception handling middleware at all? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareBeginner
6What is the purpose of global exception handling middleware in an ASP.NET Core application? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareBeginner
7What is the role of the [ApiController] attribute in automatically handling certain error scenarios without explicit exception handling code? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
8How does exception handling middleware interact with model validation errors in ASP.NET Core, and how do they typically produce different error response paths? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
9How would you design exception handling middleware to support internationalized (localized) error messages returned to clients in different languages? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
10What happens by default in ASP.NET Core if you don't configure any global exception handling middleware at all? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
11How do you catch multiple exception types with a single except clause? Python › Exception HandlingPythonException HandlingBeginner
12What is the purpose of global exception handling middleware in an ASP.NET Core application? ASP.NET Core › Error HandlingASP.NET CoreError HandlingBeginner
13What role does the [ApiController] attribute play in automatically handling certain error scenarios without explicit exception handling code? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
14How does exception handling middleware interact with model validation errors, and why do they typically produce two entirely separate error response paths? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
15How would you design exception handling to support internationalized (localized) error messages returned to different clients in their preferred language? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
16How does exception handling interact with performance, particularly regarding the cost of filling in a stack trace, and how would you optimize exception usage in a performance-critical hot path? Java › ExceptionsJavaExceptionsAdvanced
17How does exception handling interact with generics and type erasure, specifically regarding why you cannot catch a generic type parameter as an exception type (catch (T e))? Java › ExceptionsJavaExceptionsAdvanced
18What are exception filters (when) and why use them? C# › Exception HandlingC#Exception HandlingIntermediate
19How do custom exception classes work in C#, and what's the recommended convention for creating one? C# › Exception HandlingC#Exception HandlingIntermediate
20What is exception filtering using the 'when' clause, and what advantage does it offer over catching and manually re-throwing? C# › Exception HandlingC#Exception HandlingIntermediate
21How do you create a custom exception class, and what's the minimal amount of code needed? Python › Exception HandlingPythonException HandlingIntermediate
22What is the difference between 'raise' and 'raise ... from ...' for exception chaining? Python › Exception HandlingPythonException HandlingIntermediate
23How do you access details about the exception currently being handled, like its type, value, and traceback, using sys.exc_info()? Python › Exception HandlingPythonException HandlingIntermediate
24When should you create custom exceptions vs use built-in ones? C# › Exception HandlingC#Exception HandlingAdvanced
25What is the recommended strategy for exceptions in a layered/enterprise app? C# › Exception HandlingC#Exception HandlingAdvanced
26How does AggregateException work with Task.WhenAll() when multiple concurrent tasks throw exceptions? C# › Exception HandlingC#Exception HandlingAdvanced
27What is 'exception filtering with side effects' and why is it considered a controversial but sometimes useful technique for logging? C# › Exception HandlingC#Exception HandlingAdvanced
28How does exception performance (throwing/catching) compare to normal control flow, and why should exceptions generally NOT be used for expected, routine control flow? C# › Exception HandlingC#Exception HandlingAdvanced
29How does Python 3.11's exception groups (ExceptionGroup) and the 'except*' syntax let you handle MULTIPLE unrelated exceptions raised together? Python › Exception HandlingPythonException HandlingAdvanced
30How would you design a custom exception HIERARCHY for an application, and why does this matter for how callers can catch errors at different granularities? Python › Exception HandlingPythonException HandlingAdvanced
31How would you implement a retry-with-backoff decorator that catches specific transient exceptions and retries with increasing delays? Python › Exception HandlingPythonException HandlingAdvanced
32How does exception performance (raising/catching) compare to normal control flow, and why does Python's EAFP style still encourage using exceptions for routine control flow, unlike some other languages? Python › Exception HandlingPythonException HandlingAdvanced
33How would you write a context manager using @contextlib.contextmanager that both sets up a resource AND properly handles/logs any exception that occurs while it's in use? Python › Exception HandlingPythonException HandlingAdvanced
34How does exception handling work differently for Blazor components compared to a typical MVC controller action or minimal API endpoint? ASP.NET Core › Blazor Integration with ASP.NET CoreASP.NET CoreBlazor Integration with ASP.NET CoreIntermediate
35How does IExceptionFilter differ from global exception handling middleware, and when would you choose one over the other? ASP.NET Core › FiltersASP.NET CoreFiltersAdvanced
36What is the difference between throw and throw ex inside a catch? C# › Exception HandlingC#Exception HandlingBeginner
37What is the purpose of the finally block? C# › Exception HandlingC#Exception HandlingBeginner
38How does a try/catch block work in C#, and what happens if no matching catch clause exists? C# › Exception HandlingC#Exception HandlingBeginner
39What does the finally block guarantee, and when is it commonly used? C# › Exception HandlingC#Exception HandlingBeginner
40How does a try/except block work, and what happens if no matching except clause exists? Python › Exception HandlingPythonException HandlingBeginner
41What does the 'finally' block guarantee, and when is it typically used? Python › Exception HandlingPythonException HandlingBeginner
42Why is a bare 'except:' clause (catching everything with no type specified) generally discouraged? Python › Exception HandlingPythonException HandlingBeginner
43When should you use using or await using? C# › Exception HandlingC#Exception HandlingIntermediate
44Why does 'throw;' (bare throw) preserve the original stack trace, while 'throw ex;' does not? C# › Exception HandlingC#Exception HandlingIntermediate
45How does the 'else' clause on a try statement work, and what's its purpose compared to just putting that code at the end of 'try'? Python › Exception HandlingPythonException HandlingIntermediate
46What is the difference between handling exceptions with middleware versus using try/catch blocks directly in controller actions? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
47What is the difference between multicast delegate invocation and exception handling? C# › Delegates, Events & LambdasC#Delegates, Events & LambdasAdvanced
48How do you map different exception types to different HTTP status codes in a global exception handler? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
49How should a global exception handler differentiate between exceptions that should return specific client-facing details versus exceptions that should always show a generic message? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
50How do you write an integration test verifying that your global exception handler produces the correct error response shape? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
51What is exception chaining in PHP, and how does the previous exception parameter help preserve the original context when re throwing an error? PHP › Error & Exception HandlingPHPError & Exception HandlingIntermediate
52How does a try catch block work in PHP, and how do you catch and handle a specific exception that might be thrown? PHP › Error & Exception HandlingPHPError & Exception HandlingBeginner
53How would you design and implement a global, centralized exception-handling strategy for a Java application (such as a top-level handler in main(), or an uncaught exception handler for background threads), ensuring no exception silently crashes the application without being logged? Java › ExceptionsJavaExceptionsAdvanced
54What is the difference between a PHP error and a PHP exception? PHP › Error & Exception HandlingPHPError & Exception HandlingBeginner
55How does the IExceptionHandler interface (introduced in .NET 8) provide a more structured alternative to the UseExceptionHandler lambda approach? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
56How do you handle exceptions specifically within minimal API endpoints, given they don't use the traditional MVC exception filter pipeline? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
57How do you create and throw a custom exception class in PHP, and why would you define your own exception types instead of using PHP's built in generic Exception class? PHP › Error & Exception HandlingPHPError & Exception HandlingIntermediate
58How would you implement custom middleware to catch and log unhandled exceptions before they reach the exception handler, adding request-specific context? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
59How do you handle exceptions that occur during response streaming, after the response has already partially started sending to the client? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
60How do you set a global exception handler and error handler in PHP to consistently catch and log any uncaught exceptions or errors across an entire application? PHP › Error & Exception HandlingPHPError & Exception HandlingAdvanced
61What best practices should guide how an application logs, reports, and responds to exceptions differently across development and production environments? PHP › Error & Exception HandlingPHPError & Exception HandlingAdvanced
62Why is proper error handling important in a Flutter app, and what happens by default if an unhandled exception occurs somewhere within a running app? Flutter › Error Handling & Crash Reporting (Sentry & Crashlytics)FlutterError Handling & Crash Reporting (Sentry & Crashlytics)Beginner
63How does the IExceptionHandler interface (introduced in .NET 8) provide a more structured alternative to the UseExceptionHandler lambda approach? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
64How do you map different custom exception types to different HTTP status codes in a global exception handler? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
65How should a global exception handler differentiate between exceptions meant for client-facing details versus exceptions that should always show a generic message? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
66What is a common anti-pattern with catching exceptions too broadly (catch (Exception e) or worse, catch (Throwable t)), and why is it generally discouraged? Java › ExceptionsJavaExceptionsIntermediate
67How does the finally block work alongside try and catch, and what are appropriate use cases for it? PHP › Error & Exception HandlingPHPError & Exception HandlingIntermediate
68How would you write an integration test verifying that your global exception handler produces the correct error response shape for a specific exception type? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
69What is the difference between checked and unchecked exceptions in Java, and how does the compiler treat each differently? Java › ExceptionsJavaExceptionsBeginner
70What is the basic syntax and control flow of a try-catch-finally block, and what determines which catch block (if multiple exist) handles a thrown exception? Java › ExceptionsJavaExceptionsBeginner
71What is the correct usage of try-with-resources, and how does it automatically ensure a resource's close() method is called even if an exception occurs? Java › ExceptionsJavaExceptionsIntermediate
72What is the multi-catch syntax (catch (IOException | SQLException e)) introduced in Java 7, and what restriction applies to the exception types combined in a single multi-catch block? Java › ExceptionsJavaExceptionsIntermediate
73How do you create and throw a custom exception class, and what constructors should a well-designed custom exception typically provide? Java › ExceptionsJavaExceptionsIntermediate
74How do you configure PDO's error handling mode to ensure database errors are properly reported as catchable exceptions rather than silently failing? PHP › PDO & DatabasesPHPPDO & DatabasesIntermediate
75What is ProblemDetails (RFC 7807/9457), and how does ASP.NET Core support it for standardized error responses? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
76What information should be excluded from error responses in production to avoid leaking sensitive implementation details? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
77How does exception chaining (via the cause mechanism, initCause() or a constructor accepting a Throwable) preserve the original root-cause exception when wrapping and rethrowing a different exception type, and why does this matter for debugging? Java › ExceptionsJavaExceptionsAdvanced
78How would you design a custom exception hierarchy for an application, deciding when to create new exception classes versus reusing existing ones, and what fields/context should a well-designed custom exception carry? Java › ExceptionsJavaExceptionsAdvanced
79How do you handle exceptions specifically within minimal API endpoints, given they don't use the traditional MVC exception filter pipeline? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
80What is the purpose of the PrintStream and PrintWriter classes (like System.out), and how do they differ from lower-level OutputStream/Writer in their exception-handling behavior? Java › I/O & NIOJavaI/O & NIOIntermediate
81How do you handle exceptions that occur during response streaming, after the response has already partially started sending to the client? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
82How do you write a generic Result<T, E> discriminated union type for functional-style error handling, and why is it preferred over throwing exceptions in some codebases? TypeScript › Discriminated Unions & Exhaustiveness CheckingTypeScriptDiscriminated Unions & Exhaustiveness CheckingAdvanced
83How do you convert a JSON formatted string back into a PHP array or object using json_decode? PHP › JSON Handling in PHPPHPJSON Handling in PHPBeginner
84How do you properly handle errors when parsing potentially invalid JSON, and how does the JSON_THROW_ON_ERROR flag simplify this compared to manually checking json_last_error? PHP › JSON Handling in PHPPHPJSON Handling in PHPIntermediate
85What exception signals the end of iteration, and how does a for-loop use it internally? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolBeginner
86How does the 'using' statement (or 'using' declaration) ensure a FileStream is properly closed, even if an exception occurs? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
87What is the purpose of UseExceptionHandler and UseDeveloperExceptionPage middleware, and how should they differ between environments? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineIntermediate
88What is the finally block's execution guarantee, and what are the specific edge cases where a finally block might NOT execute? Java › ExceptionsJavaExceptionsIntermediate
89How does the C# 'nameof' operator work, and why is it preferred over hardcoding a string literal for things like argument names in exceptions? C# › FundamentalsC#FundamentalsAdvanced
90How would you implement timeout handling for an async generator's individual yields, so a stalled source doesn't hang the consumer forever? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersAdvanced
91How does generator.throw() let you inject an exception into a paused generator, and how would the generator handle it? Python › Comprehensions & GeneratorsPythonComprehensions & GeneratorsAdvanced
92How do you use pdb's post-mortem debugging mode to inspect a program's state exactly at the point where an unhandled exception occurred? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
93How does logger.exception() differ from logger.error(), and when should you use it? Python › LoggingPythonLoggingAdvanced
94How does the CLR handle exceptions at a low level, and what is the performance implication of throwing exceptions frequently? .NET › CLR & Runtime.NETCLR & RuntimeAdvanced
95How would you implement a custom enum that also functions as a lookup table (mapping an external code to a constant), such as parsing an HTTP status code string into an enum constant, handling unknown values gracefully? Java › EnumsJavaEnumsAdvanced
96What is the difference between an unhandled promise rejection and an uncaught exception in Node.js, and how does Node handle each by default? Node.js › Async PatternsNode.jsAsync PatternsAdvanced
97How do you handle an uncaught exception inside a specific cluster worker without taking down the entire application? Node.js › Clustering & Worker ThreadsNode.jsClustering & Worker ThreadsAdvanced
98How do you check for and handle stream errors? C++ › I/O StreamsC++I/O StreamsBeginner
99How do you access, add, and remove items from a dictionary? Python › Data Types & StructuresPythonData Types & StructuresBeginner
100How do you use the built-in pdb debugger to pause execution at a specific line? Python › Debugging & ProfilingPythonDebugging & ProfilingBeginner
101How do you add a setter to a property so assignment (obj.attr = value) triggers custom logic, like validation? Python › Descriptors & PropertiesPythonDescriptors & PropertiesBeginner
102How do you open and read a text file using the 'with' statement, and why is 'with' preferred over manual open()/close()? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersBeginner
103What does the built-in next() function's optional default argument do? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolBeginner
104How do you manually exhaust and inspect an iterator without a for-loop? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolBeginner
105Why should you use the logging module instead of print() for diagnostic output? Python › LoggingPythonLoggingBeginner
106What is middleware in ASP.NET Core, and how does it form the request pipeline? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineBeginner
107What are magic methods in PHP, and how do the __construct and __destruct methods represent two of the most commonly used examples? PHP › Magic MethodsPHPMagic MethodsBeginner
108How does an API typically use HTTP status codes to communicate the result of a request, and what do common codes like 200, 404, and 500 represent? PHP › RESTful API Development with PHPPHPRESTful API Development with PHPBeginner
109What does declaring strict_types=1 at the top of a PHP file actually change about how type declarations are enforced? PHP › Type Declarations & Strict TypesPHPType Declarations & Strict TypesBeginner
110What is RAII and how does it relate to memory management? C++ › Memory ManagementC++Memory ManagementIntermediate
111Why does calling .Result or .Wait() on a Task risk causing a deadlock, particularly in ASP.NET (non-Core) or UI applications? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingIntermediate
112What does ConfigureAwait(false) do, and when is it appropriate to use? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingIntermediate
113How do you run multiple asynchronous operations concurrently and wait for all of them using Task.WhenAll? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingIntermediate
114How does 'yield break' work, and how does it differ from a plain 'return' statement inside a regular method? C# › Iterators & yield returnC#Iterators & yield returnIntermediate
115What is the difference between First(), FirstOrDefault(), Single(), and SingleOrDefault()? C# › LINQC#LINQIntermediate
116How does an async generator interact with try/finally for guaranteed cleanup, similar to regular generators? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersIntermediate
117How do you specify a default value and a type conversion for an argument? Python › Command-Line Interfaces (argparse)PythonCommand-Line Interfaces (argparse)Intermediate
118How do you specify default values for dataclass fields, and what ordering restriction applies? Python › Dataclasses & NamedTuplesPythonDataclasses & NamedTuplesIntermediate
119How do assert statements work for debugging, and why should they NOT be relied upon for production input validation? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
120How do you use Python's built-in 'warnings' module to surface deprecated or risky code paths during debugging? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
121How do you write a decorator that itself accepts arguments, like @retry(times=3)? Python › DecoratorsPythonDecoratorsIntermediate
122How do you write and use a custom context manager by implementing __enter__ and __exit__? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersIntermediate
123How do you use multiple context managers in a single 'with' statement, and how does this compare to nesting separate 'with' blocks? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersIntermediate
124How do you check whether a file or directory exists before operating on it, using pathlib? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersIntermediate
125What does functools.reduce's initializer argument do, and why should you usually provide one? Python › functools & Functional Programming ToolsPythonfunctools & Functional Programming ToolsIntermediate
126How do context managers and the `del` statement relate to timely memory cleanup versus relying on garbage collection? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
127How do you call a specific ancestor's method explicitly, bypassing the normal MRO-based super() resolution? Python › Multiple Inheritance & MROPythonMultiple Inheritance & MROIntermediate
128What HTTP status code and response should an API return when a client requests a version that no longer exists or was never supported? .NET › API Versioning.NETAPI VersioningIntermediate
129Why does the order in which middleware is registered matter so much in ASP.NET Core? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineIntermediate
130What's the difference between app.Use, app.Run, and app.Map in configuring the middleware pipeline? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineIntermediate
131How does short-circuiting work in middleware, and when would you deliberately not call next()? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineIntermediate
132What are the security risks of storing JWTs in browser localStorage versus HttpOnly cookies? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Intermediate
133How do you validate configuration options at application startup to fail fast on misconfiguration? .NET › Configuration & Options.NETConfiguration & OptionsIntermediate
134What is the difference between CORS and CSRF (Cross-Site Request Forgery), and how does CORS relate to (but not fully prevent) CSRF? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingIntermediate
135How do you register multiple implementations of the same interface, and how do you resolve all of them together? .NET › Dependency Injection.NETDependency InjectionIntermediate
136What is a memory dump, and how do you capture and analyze one for a .NET application experiencing high memory usage or a crash? .NET › Diagnostics & Performance.NETDiagnostics & PerformanceIntermediate
137What is the difference between First(OrDefault) and Single(OrDefault) in EF Core queries, and when should you use each? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessIntermediate
138How do you configure and use raw SQL queries alongside LINQ in EF Core when a complex query is difficult or inefficient to express in LINQ? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessIntermediate
139What security risk does dynamically reflecting the Origin header back as Access-Control-Allow-Origin introduce, and why is it a dangerous anti-pattern? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Intermediate
140What does GetService<T>() return compared to GetRequiredService<T>() when a service isn't registered, and which should application code generally prefer? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionIntermediate
141How do you handle and propagate errors in gRPC, given it doesn't use standard HTTP status codes the way REST does? ASP.NET Core › gRPC ServicesASP.NET CoregRPC ServicesIntermediate
142How do database transactions work in PDO, and why are they important for ensuring multiple related database operations either all succeed together or all fail together? PHP › PDO & DatabasesPHPPDO & DatabasesIntermediate
143How does a middleware pipeline execute multiple middleware in sequence, and how does the concept of calling the next middleware let each one decide whether to continue processing the request? PHP › Routing & MiddlewarePHPRouting & MiddlewareIntermediate
144What happens when a single class uses multiple traits that happen to define a method with the exact same name, and how can this naming conflict be resolved? PHP › TraitsPHPTraitsIntermediate
145What are nullable types and union types in PHP, and how do they let you express that a value could be one of several different possible types? PHP › Type Declarations & Strict TypesPHPType Declarations & Strict TypesIntermediate
146What is the difference between a memory leak and a resource leak? C++ › Memory ManagementC++Memory ManagementAdvanced
147How does CancellationToken propagate cancellation requests through a chain of async method calls? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingAdvanced
148How do you safely validate that an enum value received from external input (like deserialized JSON or a database) is actually a DEFINED member, given that enums don't enforce this by default? C# › Enums & FlagsC#Enums & FlagsAdvanced
149How would you write extension methods to build a lightweight, fluent validation/guard-clause library? C# › Extension MethodsC#Extension MethodsAdvanced
150How would you implement a robust, atomic file-write operation that avoids leaving a corrupted or partially-written file if the process crashes mid-write? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
151How do you implement the 'checked' operator overload variant (introduced in C# 11) to provide overflow-checking behavior for a custom numeric type? C# › Indexers & Operator OverloadingC#Indexers & Operator OverloadingAdvanced
152How do you properly propagate cancellation into an async generator when the consuming task is cancelled mid-iteration? Python › Async Generators & Async Context ManagersPythonAsync Generators & Async Context ManagersAdvanced
153How do you implement mutually exclusive arguments, where the user must choose EXACTLY ONE of a set of flags? Python › Command-Line Interfaces (argparse)PythonCommand-Line Interfaces (argparse)Advanced
154How do you write a custom 'type=' validation function for argparse that raises a properly-formatted error for invalid input? Python › Command-Line Interfaces (argparse)PythonCommand-Line Interfaces (argparse)Advanced
155How do you correctly close a generator early and ensure any try/finally cleanup inside it still runs? Python › Comprehensions & GeneratorsPythonComprehensions & GeneratorsAdvanced
156How do you correctly cancel a running asyncio task, and how should the task itself handle the resulting CancelledError? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
157How would you design a robust worker pool that handles both graceful shutdown (finishing in-flight work) and immediate cancellation (dropping everything), using asyncio? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Advanced
158How do you add validation logic to a dataclass field using __post_init__? Python › Dataclasses & NamedTuplesPythonDataclasses & NamedTuplesAdvanced
159How does @property's read-only behavior (no setter defined) actually raise an AttributeError, and how would you customize that error message? Python › Descriptors & PropertiesPythonDescriptors & PropertiesAdvanced
160How would you implement a context manager that temporarily changes the current working directory and restores it afterward? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersAdvanced
161How does the iterator protocol interact with the with-statement for resource-managing iterables like file objects? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolAdvanced
162How would you write a custom logging.Filter to redact sensitive data like passwords from log messages? Python › LoggingPythonLoggingAdvanced
163How do context manager magic methods __enter__ and __exit__ work, and what does __exit__'s return value control? Python › Magic Methods & Operator OverloadingPythonMagic Methods & Operator OverloadingAdvanced
164How do abstract base classes (ABCs) use a metaclass to enforce that subclasses implement required methods? Python › Metaclasses & Class CustomizationPythonMetaclasses & Class CustomizationAdvanced
165What is the 'tolerant reader' pattern, and how does it reduce the need for frequent API versioning? .NET › API Versioning.NETAPI VersioningAdvanced
166How does the CLR ensure type safety and memory safety, and what categories of bugs does this prevent compared to unmanaged languages like C++? .NET › CLR & Runtime.NETCLR & RuntimeAdvanced
167What security risks does an overly permissive CORS policy (like AllowAnyOrigin with credentials attempted, or reflecting the Origin header) introduce? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingAdvanced
168How do you handle optimistic concurrency conflicts in EF Core using a concurrency token (like RowVersion)? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessAdvanced
169How does gRPC handle errors and status codes, and how does this differ from HTTP status codes in REST? .NET › gRPC Services.NETgRPC ServicesAdvanced
170How does the AuthorizationMiddlewareResultHandler let you customize the response returned when authorization fails, beyond the default 401/403? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationAdvanced
171How do you validate configuration options at application startup to fail fast on misconfiguration, using ValidateDataAnnotations and ValidateOnStart? ASP.NET Core › Configuration & Options PatternASP.NET CoreConfiguration & Options PatternAdvanced
172How do you write a custom IValidateOptions<T> implementation for validation logic beyond what DataAnnotations attributes can express? ASP.NET Core › Configuration & Options PatternASP.NET CoreConfiguration & Options PatternAdvanced
173How would you configure an API to return Problem Details (RFC 7807) formatted error responses consistently across all content types, not just JSON? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersAdvanced
174How would you implement a filter that modifies the action's result based on the outcome, such as wrapping every successful response in a standard envelope? ASP.NET Core › FiltersASP.NET CoreFiltersAdvanced
175How does PHP's type coercion behave differently in strict types mode compared to the default coercive mode, and what are the implications for function argument and return type validation? PHP › Basics & TypesPHPBasics & TypesAdvanced
176How should an application handle database connection failures gracefully, including implementing retry logic and connection health checks for a reliable production system? PHP › PDO & DatabasesPHPPDO & DatabasesAdvanced
177How can PHP's built in disabled functions setting and other server level configuration hardening reduce the impact of a successful attack against an application? PHP › SecurityPHPSecurityAdvanced