All fields

“Background Tasks & Hosted Services” in Information Technology

49 questions across 3 technologies.

Information Technology

49 questions in 3 technologies

#QuestionTechnologyTopicLevel
1How do you safely access scoped services like a DbContext from within a BackgroundService, which is registered as a singleton? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
2How do multiple independently-registered BackgroundServices coexist within the same application, and does registration order matter? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
3What is the difference between IHostedService and the BackgroundService convenience base class? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
4How do background services interact with health checks to signal their operational status to an orchestrator like Kubernetes? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
5How would you implement retry logic with exponential backoff for a background service that calls a potentially-flaky external API? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
6What is a BackgroundService in ASP.NET Core, and how do you register one to run alongside a web application? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesBeginner
7How should exceptions be handled inside a BackgroundService's work loop to prevent one failure from silently stopping all future processing? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
8How does IHostApplicationLifetime let a BackgroundService react to application startup and shutdown events? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
9How would you configure a BackgroundService to fail fast and crash the host if a critical startup dependency (like a message broker) is unreachable? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
10How does graceful shutdown work for a BackgroundService, and how should ExecuteAsync respect the CancellationToken? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
11How would you implement a producer-consumer background processing pipeline using System.Threading.Channels alongside a BackgroundService? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
12How would you implement a cron-like scheduled background job (e.g., 'run daily at 2 AM') without a third-party scheduling library? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
13How would you implement a background task queue accepting ad-hoc work items dynamically at runtime, rather than a fixed polling loop? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
14How do you test a BackgroundService's business logic without waiting for its actual polling interval, keeping tests fast? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesAdvanced
15How do you implement a periodic scheduled task using PeriodicTimer instead of Task.Delay, and what problem does it solve? ASP.NET Core › Background Tasks & Hosted ServicesASP.NET CoreBackground Tasks & Hosted ServicesIntermediate
16How do you use IServiceScopeFactory to manually create a DI scope outside the normal per-request pipeline, such as inside a background service? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionIntermediate
17How do the four gRPC method types (unary, server streaming, client streaming, bidirectional streaming) differ, and when would you use each? ASP.NET Core › gRPC ServicesASP.NET CoregRPC ServicesAdvanced
18What is the ASP.NET Core Health Checks middleware, and what problem does it solve? ASP.NET Core › Health ChecksASP.NET CoreHealth ChecksBeginner
19What are the two primary ways to create a thread in Java (extending Thread versus implementing Runnable), and which is generally preferred? Java › Concurrency & ThreadsJavaConcurrency & ThreadsBeginner
20What is the difference between calling Thread.start() and Thread.run() directly, and why is calling run() directly a common beginner mistake? Java › Concurrency & ThreadsJavaConcurrency & ThreadsBeginner
21What is the difference between the async and await keywords in C#, and how do they work together? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingBeginner
22What is the difference between Singleton, Scoped, and Transient service lifetimes, and how does Scoped specifically map to an HTTP request? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionIntermediate
23How does the Options pattern's IOptions<T>/IOptionsSnapshot<T> relate to and build upon the standard DI container? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionIntermediate
24What is the difference between temporary file storage (during processing) and permanent storage for uploaded files, and why should uploads generally not be saved directly to their final destination? ASP.NET Core › File Uploads & Streaming Large FilesASP.NET CoreFile Uploads & Streaming Large FilesIntermediate
25How do health checks interact with dependency injection scoping, particularly for checks that need a scoped service like a DbContext? ASP.NET Core › Health ChecksASP.NET CoreHealth ChecksIntermediate
26What is the ASP.NET Core Module (ANCM), and what specific role does it play when hosting under IIS? ASP.NET Core › Hosting Models: Kestrel, IIS & Reverse ProxiesASP.NET CoreHosting Models: Kestrel, IIS & Reverse ProxiesIntermediate
27How do you configure request timeout behavior differently at the Kestrel level versus the reverse proxy level, and why might they need to be coordinated? ASP.NET Core › Hosting Models: Kestrel, IIS & Reverse ProxiesASP.NET CoreHosting Models: Kestrel, IIS & Reverse ProxiesIntermediate
28What is the ExecutorService framework, and why is it generally preferred over manually creating and managing individual Thread objects? Java › Concurrency & ThreadsJavaConcurrency & ThreadsIntermediate
29What is the difference between wait()/notify()/notifyAll() (Object's intrinsic monitor methods) and the newer java.util.concurrent tools, and why are the older methods considered error-prone? Java › Concurrency & ThreadsJavaConcurrency & ThreadsIntermediate
30How would you use the WatchService API (java.nio.file) to monitor a directory for file system changes (creation, modification, deletion) in real time? Java › I/O & NIOJavaI/O & NIOIntermediate
31How would you make an asynchronous, non-blocking HTTP request using HttpClient's sendAsync() method, and how does the returned CompletableFuture integrate with the rest of an asynchronous pipeline? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientIntermediate
32How would you implement real-time UI updates in a Blazor Server component in response to a backend event, like a new order being placed elsewhere in the system? ASP.NET Core › Blazor Integration with ASP.NET CoreASP.NET CoreBlazor Integration with ASP.NET CoreAdvanced
33What is the difference between IOptions<T>, IOptionsSnapshot<T>, and IOptionsMonitor<T>, and which is safe to inject into a singleton? ASP.NET Core › Configuration & Options PatternASP.NET CoreConfiguration & Options PatternAdvanced
34How does configuration hot-reload work with reloadOnChange for appsettings.json, and what are its limitations? ASP.NET Core › Configuration & Options PatternASP.NET CoreConfiguration & Options PatternAdvanced
35What is the 'captive dependency' problem, and how does ASP.NET Core's DI container help catch it automatically? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionAdvanced
36How would you implement resumable/chunked file uploads to support very large files over unreliable network connections? ASP.NET Core › File Uploads & Streaming Large FilesASP.NET CoreFile Uploads & Streaming Large FilesAdvanced
37How would you implement virus/malware scanning for uploaded files before they're made available for download by other users? ASP.NET Core › File Uploads & Streaming Large FilesASP.NET CoreFile Uploads & Streaming Large FilesAdvanced
38How do you differentiate liveness and readiness health checks using tags, and why does Kubernetes treat these two probe types differently? ASP.NET Core › Health ChecksASP.NET CoreHealth ChecksAdvanced
39How would you implement a startup-specific health check distinct from ongoing liveness/readiness, useful for slow-starting applications with lengthy initialization (like cache warming or large data loads)? ASP.NET Core › Health ChecksASP.NET CoreHealth ChecksAdvanced
40How would you implement graceful shutdown handling in Kestrel/ASP.NET Core to ensure in-flight requests complete before a container or process terminates during a deployment or scale-down event? ASP.NET Core › Hosting Models: Kestrel, IIS & Reverse ProxiesASP.NET CoreHosting Models: Kestrel, IIS & Reverse ProxiesAdvanced
41How would you implement automated, zero-downtime certificate renewal using Let's Encrypt (ACME protocol) for a production ASP.NET Core deployment? ASP.NET Core › HTTPS, Certificates & Transport SecurityASP.NET CoreHTTPS, Certificates & Transport SecurityAdvanced
42How would you write a custom Maven plugin or Gradle task to perform project-specific build automation not covered by existing plugins? Java › Build Tools: Maven & GradleJavaBuild Tools: Maven & GradleAdvanced
43How does java.util.concurrent's ReentrantLock differ from the synchronized keyword, and what additional capabilities does it provide (tryLock, fairness, interruptible locking)? Java › Concurrency & ThreadsJavaConcurrency & ThreadsAdvanced
44How do CompletableFuture's composition methods (thenApply, thenCompose, thenCombine) enable building asynchronous pipelines, and what's the difference between thenApply and thenCompose? Java › Concurrency & ThreadsJavaConcurrency & ThreadsAdvanced
45How would you use CountDownLatch, CyclicBarrier, and Semaphore for different thread coordination scenarios, and what distinguishes their use cases? Java › Concurrency & ThreadsJavaConcurrency & ThreadsAdvanced
46How would you implement asynchronous file I/O using AsynchronousFileChannel, and how does this differ from both the classic blocking java.io model and NIO's Selector-based non-blocking channels? Java › I/O & NIOJavaI/O & NIOAdvanced
47How would you implement file locking (using FileLock) to coordinate exclusive access to a shared file across multiple processes, and what are the platform-specific reliability caveats? Java › I/O & NIOJavaI/O & NIOAdvanced
48How would you implement a recurring event scheduling system that correctly handles both fixed-instant recurrence (every exactly 24 hours) and calendar-based recurrence (every day at 9 AM local time), given these have meaningfully different behavior across DST transitions? Java › Java Date & Time API (java.time)JavaJava Date & Time API (java.time)Advanced
49How would you implement a WebSocket client using java.net.http.WebSocket for real-time, bidirectional communication, and how does its event-driven Listener interface work? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientAdvanced