Java Backend SDE Interview Questions and Topics

I recently interviewed for SDE (1+ years, Java Backend) role at a startup. Sharing the questions and topics asked: 🔸 Round 1 • DSA: Given a binary array, find the longest subarray with equal number of 0s and 1s (code in Java) • Java Streams: Given a list of integers from 1 to 10 (unordered), remove elements greater than 5, multiply remaining elements by 2, return final list Follow-ups: – Parallel streams – Does parallel stream always guarantee efficiency? • Comparable vs Comparator in Java – Which one is used in sort() in streams? • Design Question: Implement a Stack in Java with operations: push(), pop(), pop(element) → pop(element) should work in O(1) while maintaining order • Discussion: – Approach and data structures (HashMap + Doubly LinkedList like LRU) – Which DS is preferred for heavy insertion/deletion operations? • Multithreading: Thread pool with corePoolSize = 5 and maxPoolSize = 10 50 tasks, each takes 1 hour – How threads execute tasks? – When are extra threads (beyond core) used? – What happens to the 21st task and others? • MongoDB basics • SQL: Find the second highest salary from employee table • Resume-based questions 🔸 Round 2 • Introduction + detailed resume discussion (projects, use cases, tech choices) • MongoDB: Why you used MongoDB? • Java: – Java versions worked on – Favorite feature in Java 21 – PermGen vs Metaspace • HashMap + Multithreading scenario: Thread t1 works on keys 1–10 and t2 works on keys 11–12 – Will there be collision? – What happens internally? – Can race condition occur? • Concurrency: – volatile vs Atomic – Where are they used? – Optimistic vs Pessimistic locking • Networking: – HTTP/1 vs HTTP/2 – TCP handshake • Messaging Systems: – Kafka (partitions) – RabbitMQ • NoSQL System Design: Given 3 servers for NoSQL DB – How to handle reads/writes efficiently? – Master-Slave architecture – Where to keep logic for master selection and failover? • CAP Theorem discussion – Which two to prefer and why? • System Design: Rate Limiter – Based on endpoint / user / time window – Where and how to store data for specific time? – How to manage configs? – Rate Limiter Design: Components + key generation (hashing) + Redis counter + time window + allow/reject decision. – Rate Limiting Algorithms: Sliding Window log, Token Bucket, and Leaky Bucket. • PostgreSQL: – Indexing based on columns and use cases • DSA: Find longest consecutive sequence in an array ▫️ If you're preparing for backend roles, this is the level of depth you should expect. Happy to discuss any of these topics or share approaches 🙌 #SoftwareEngineering #BackendDevelopment #Java #SystemDesign #DataStructures #Algorithms #TechInterviews #CodingInterview #SDE

To view or add a comment, sign in

Explore content categories