Zerodha Interview Preparation

Top interview questions and answers for Zerodha placements.

QuestionAnswerCategory
Q1. Reverse a Linked List and explain time complexity.Iterative approach: Maintain prev, curr, next pointers. Time: O(N), Space: O(1).Coding
Q2. Detect a cycle in a Directed Graph.Use DFS with a recursion stack or Kahns Algorithm (BFS). Return true if back edge is found.Coding
Q3. Top K Frequent Elements in an Array.Use a HashMap to store frequencies, then a Min-Heap of size K, or Bucket Sort.Coding
Q4. Longest Common Subsequence between two strings.Dynamic Programming using a 2D array. Time & Space complexity is O(M*N).Coding
Q5. Merge Intervals.Sort intervals by start time, then iterate and merge overlaps.Coding
Q6. Binary Tree Maximum Path Sum.Post-order traversal updating a global maximum path sum.Coding
Q7. Search in a Rotated Sorted Array.Modified Binary Search checking which half is strictly sorted.Coding
Q8. Trapping Rain Water.Use two pointers or precompute maximum left and right heights. O(N) time, O(1) space.Coding
Q9. Find the Median of Two Sorted Arrays.Binary Search on the smaller array. O(log(min(M,N))).Coding
Q10. Word Break Problem.Dynamic Programming array for string segmentation. O(N^2) time.Coding
Q11. Implement an LRU Cache.Doubly Linked List for tracking order and a HashMap for O(1) access.Coding
Q12. Sort an array of 0s, 1s, and 2s (Dutch National Flag).Three pointers: low, mid, high. Swap elements to partition array.Coding
Q13. Clone a Graph.BFS or DFS using a HashMap to track cloned nodes.Coding
Q14. Serialize and Deserialize a Binary Tree.Level order traversal (BFS) with null markers.Coding
Q15. Coin Change Problem.Dynamic programming tracking minimum coins needed for amounts.Coding
Q16. Explain Memory Management and Garbage Collection in Java.Discussion on Heap vs Stack, GC algorithms, and reference management in Java.Technical
Q17. How does Java handle Concurrency and Multi-threading?Use of threads, locks, mutexes, and internal concurrency models (Async/Await, Thread Pools).Technical
Q18. Explain indexing and how it improves query performance in SQL.B-Tree/Hash indexes reduce disk I/O allowing logarithmic time lookups.Technical
Q19. What is the difference between an Interface and an Abstract Class?Abstract classes can have state and implemented methods; Interfaces define a strict contract.Technical
Q20. How would you optimize a slow-performing API endpoint?Analyze DB queries, use Redis caching, implement pagination, and apply async processing.Technical
Q21. Explain the ACID properties with respect to SQL.Atomicity, Consistency, Isolation, Durability.Technical
Q22. Microservices vs Monolithic Architecture: Pros and Cons.Monoliths are easier to deploy but hard to scale. Microservices offer independent scaling but introduce complexity.Technical
Q23. What are Design Patterns? Explain Singleton and Factory.Reusable solutions. Singleton ensures one instance. Factory creates objects without exposing logic.Technical
Q24. Solid Principles of Object-Oriented Design.Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion.Technical
Q25. How do you prevent SQL Injection and XSS vulnerabilities?Parameterized queries for SQLi. Output encoding, sanitization, and CSP for XSS.Technical
Q26. Describe how a Hash Map works internally.Array of buckets. Hash function computes index. Collisions handled via linked lists.Technical
Q27. Explain the CAP Theorem.Consistency, Availability, Partition Tolerance. Choose between C and A during a network partition.Technical
Q28. What is Dependency Injection and Inversion of Control?Passing dependencies via constructors rather than creating them internally.Technical
Q29. REST vs GraphQL vs gRPC.REST (stateless), GraphQL (reduces over-fetching), gRPC (high performance Protobuf).Technical
Q30. Explain CI/CD pipelines and deployment strategies.Continuous Integration / Deployment. Blue-Green vs Canary deployments for zero-downtime.Technical
Q31. How would you design a scalable architecture for a Technology and Services platform?Load balancers, stateless APIs, read replicas, caching layer, and message queues.System Design
Q32. Design an analytics tracking system for Zerodha handling millions of events per second.Data ingestion via Kafka, stream processing with Flink/Spark, batch storage in S3.System Design
Q33. Design a Rate Limiter for Zerodha APIs.Token Bucket algorithm using Redis with Lua scripts.System Design
Q34. How does Database Sharding work? When would you use it at Zerodha?Horizontal partitioning of data. Used when table size exceeds single node capacity.System Design
Q35. Design a Distributed Cache like Redis/Memcached.Consistent Hashing, LRU eviction policy, Replication for high availability.System Design
Q36. Explain Long Polling vs WebSockets vs Server-Sent Events.WebSockets for bi-directional communication. SSE for server-to-client streaming.System Design
Q37. Design a URL Shortener service.Base62 encoding of a unique ID. Hash table storage with caching.System Design
Q38. Design a Notification System (Email, SMS, Push).Message Queues for async processing, User preference DB, Retry mechanisms.System Design
Q39. How do you ensure high availability and disaster recovery?Multi-AZ deployments, Active-Active failover, regular backups.System Design
Q40. Explain Consistent Hashing.Mapping keys and nodes to a circular hash ring to minimize key remapping on scaling.System Design
Q41. Why do you want to join Zerodha specifically?Align personal goals with company domain (Technology and Services) and values (Teamwork).HR
Q42. Tell me about a time you had a conflict and how you resolved it.Use STAR method. Emphasize active listening and focusing on project goals.HR
Q43. Describe a time you failed at a project.Acknowledge the mistake openly, discuss the root cause, and explain preventive measures.Managerial
Q44. How do you handle strict deadlines at Zerodha?Agile planning, MVP approach, clear communication regarding scope trade-offs.Managerial
Q45. Where do you see your career heading in the next 3 to 5 years?Focus on continuous learning, assuming technical leadership at Zerodha.HR
Q46. Tell me about a time you had to learn Python quickly.Discuss learning strategy and how it successfully contributed to project delivery.Managerial
Q47. What is your greatest strength and weakness?Strength: rapid problem solving. Weakness: over-analyzing, managed by setting target times.HR
Q48. How do you mentor junior developers?Constructive feedback, focusing on logic not just syntax, encouraging questions.Managerial
Q49. Describe a time you went above and beyond.Focus on ownership—e.g., fixing a systemic issue or optimizing an old process.HR
Q50. How do you measure the success of a feature after deployment?Tracking metrics like latency, error rates, user engagement, and gathering user feedback.Managerial