Good questions in interview

paytm logo
paytm
Backend Engineer
May 7, 2025 β€’ 6 reads

Summary

I encountered various specific technical questions during my recent backend interviews, covering Java, Spring Boot, system design, Kafka, and low-level design, and provided my approaches to solving them.

Full Experience

πŸš€ During my recent backend interviews, I encountered some intriguing questions I came across. Here's some of them :

β˜• Java + Spring Boot Q: How do you configure thread pools in Spring Boot to ensure efficient task execution under high load? βœ… Used ThreadPoolTaskExecutor to manage thread pools. βœ… Tuned corePoolSize and maxPoolSize based on whether tasks were CPU-bound or IO-bound. βœ… Adjusted keepAliveTime to recycle idle threads and reduce resource usage.

πŸ” System Recovery with Backlog Processing Q: Your app handles 100 RPS and each task takes 100ms. A 5-minute outage means 30K pending tasks. Once restored, how do you process backlog + new incoming traffic in 5 minutes? βœ… Needed to support 200 RPS (100 backlog + 100 new). βœ… Designed executor with sufficient thread pool and queue capacity. βœ… Discussed scaling strategies: using separate executors to meet deadlines.

🧩 Singleton Injecting a Request-Scoped Bean Q: Why does injecting a @RequestScope bean into a singleton fail in Spring Boot? βœ… Request-scoped beans are instantiated per HTTP request, but singleton beans are created at app startup. πŸ”§ Fixes: Used ObjectFactory, Provider, or enabled proxying for lazy injection.

πŸ”„ @RefreshScope in Spring Cloud Q: What is the role of @RefreshScope in dynamic configuration updates? βœ… Allows runtime refresh of beans when config values change in Spring Cloud Config. βœ… Works with Spring Cloud Bus to auto-propagate config changesβ€”no app restart needed.

πŸ“© Kafka Q: If a Kafka consumer fails to process a message, how do you retry it 5 times and eventually discard it? βœ… Built retry logic using separate retry topics with increasing backoff. βœ… After 5 attempts, failed messages are sent to a Dead Letter Queue (DLQ) for logging or manual handling. βœ… Ensures fault-tolerance without losing messages silently.

🧱 LLD – Canvas Fill Tool πŸ–ŒοΈ Design an MS Paint-like canvas fill backend: Q: Users can draw closed shapes. If they click inside, the entire shape should be filled. Clicking outside fills only that pixel. βœ… Tracked shape boundaries. βœ… Used Flood Fill Algorithm (DFS/BFS) to propagate fill from clicked pixel until boundaries are hit. βœ… Ensured scalability for large canvases and concurrent fill operations.

βš™οΈ Infra & System Design πŸ“¦ PostgreSQL Internals Q: How does PostgreSQL optimize query execution and data retrieval? βœ… Discussed B-Tree and GIN indexes.

🌐 Kubernetes Service Discovery Q: Pod IPs change frequently. How do services reliably discover and communicate with each other? βœ… Kubernetes assigns a stable ClusterIP to each service.

πŸ“¬ Designing a Pub/Sub System Q: How do you implement a loosely-coupled publisher-subscriber architecture? βœ… Used Observer Pattern, Event Bus libraries, or message brokers like Kafka/RabbitMQ.

Interview Questions (8)

Q1
System Recovery and Backlog Processing
System Design

Your app handles 100 RPS and each task takes 100ms. A 5-minute outage means 30K pending tasks. Once restored, how do you process backlog + new incoming traffic in 5 minutes?

Q2
Injecting Request-Scoped Bean into Singleton in Spring Boot
Other

Why does injecting a @RequestScope bean into a singleton fail in Spring Boot?

Q3
Role of @RefreshScope in Spring Cloud
Other

What is the role of @RefreshScope in dynamic configuration updates?

Q4
Kafka Consumer Retry and Dead Letter Queue
System Design

If a Kafka consumer fails to process a message, how do you retry it 5 times and eventually discard it?

Q5
Low-Level Design: MS Paint-like Canvas Fill Backend
Data Structures & Algorithms

Users can draw closed shapes. If they click inside, the entire shape should be filled. Clicking outside fills only that pixel.

Q6
PostgreSQL Query Optimization
System Design

How does PostgreSQL optimize query execution and data retrieval?

Q7
Kubernetes Service Discovery
System Design

Pod IPs change frequently. How do services reliably discover and communicate with each other?

Q8
Designing a Loosely-Coupled Pub/Sub System
System Design

How do you implement a loosely-coupled publisher-subscriber architecture?

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!