All fields

“Error & Exception Handling” in Information Technology

60 questions across 10 technologies.

Information Technology

60 questions in 10 technologies

#QuestionTechnologyTopicLevel
1What 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
2What is the difference between a PHP error and a PHP exception? PHP › Error & Exception HandlingPHPError & Exception HandlingBeginner
3How 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
4How 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
5How 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
6What 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
7How does the finally block work alongside try and catch, and what are appropriate use cases for it? PHP › Error & Exception HandlingPHPError & Exception HandlingIntermediate
8Why 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
9What 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
10What 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
11How 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
12How 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
13How 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
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 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
17What 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
18How 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
19What is the purpose of global exception handling middleware in an ASP.NET Core application? ASP.NET Core › Error HandlingASP.NET CoreError HandlingBeginner
20How 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
21How 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
22How 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
23How 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
24How 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
25How 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
26What 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
27What information should be excluded from error responses in production to avoid leaking sensitive implementation details? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
28How 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
29How 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
30How 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
31What is the difference between checked and unchecked exceptions in Java, and how does the compiler treat each differently? Java › ExceptionsJavaExceptionsBeginner
32What 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
33How 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
34What 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
35What 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
36How do you create and throw a custom exception class, and what constructors should a well-designed custom exception typically provide? Java › ExceptionsJavaExceptionsIntermediate
37How 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
38How 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
39How does logger.exception() differ from logger.error(), and when should you use it? Python › LoggingPythonLoggingAdvanced
40How 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
41How 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
42What is the finally block's execution guarantee, and what are the specific edge cases where a finally block might NOT execute? Java › ExceptionsJavaExceptionsIntermediate
43How 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
44How do you check for and handle stream errors? C++ › I/O StreamsC++I/O StreamsBeginner
45How 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
46How 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
47How 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
48How does gRPC handle errors and status codes, and how does this differ from HTTP status codes in REST? .NET › gRPC Services.NETgRPC ServicesAdvanced
49What 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
50How 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
51What 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
52How 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
53What 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
54How 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
55How 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
56What 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
57What 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
58How 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
59How 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
60How 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