Microsoft Interview Questions
Balanced across Java, Spring Boot, and SQL. Backend roles test REST API design, database optimization, and cloud-native patterns.
#1What is the difference between == and .equals() in Java?
#2What is the difference between abstract class and interface?
#3Explain the SOLID principles.
#4How does HashMap work internally?
#5What is the difference between HashMap and ConcurrentHashMap?
#6Explain Java Memory Model: Heap, Stack, and Metaspace.
#7What is the volatile keyword in Java?
#8What is the difference between synchronized and ReentrantLock?
#9What is a deadlock and how do you prevent it?
#10What are functional interfaces and lambda expressions in Java 8?
#11What is Optional and when should you use it?
#12Explain the Stream API and intermediate vs terminal operations.
#13What is the difference between checked and unchecked exceptions?
#14What is the difference between String, StringBuilder, and StringBuffer?
#15What is garbage collection? How does G1 differ from ZGC?
#16What is method overloading vs method overriding?
#17What is the Java ClassLoader hierarchy?
#18What is the difference between final, finally, and finalize?
#19What are Java records (Java 16+)?
#20What is the Executor framework and when would you use it over raw Threads?
#21What is encapsulation and how is it achieved in Java?
#22What is polymorphism? Explain runtime vs compile-time polymorphism.
#23What is the difference between composition and inheritance?
#24What is a marker interface? Give examples.
#25What are the design patterns most commonly asked in Java interviews?
#26How do you implement a Singleton in Java correctly?
#27What is the difference between ArrayList and LinkedList?
#28What is the difference between HashSet, LinkedHashSet, and TreeSet?
#29What is the difference between HashMap and TreeMap?
#30What is the contract between equals() and hashCode()?
#31What is the difference between fail-fast and fail-safe iterators?
#32What is CopyOnWriteArrayList and when should you use it?
#33How does PriorityQueue work and when would you use it?
#34What is the happens-before relationship in Java Memory Model?
#35What is the difference between sleep(), wait(), and yield()?
#36What are atomic classes (AtomicInteger, AtomicReference)? How do they work?
#37What is a CountDownLatch vs CyclicBarrier?
#38What is a ThreadLocal and what are its dangers?
#39What is a CompletableFuture and how does it improve async programming?
#40What are virtual threads (Project Loom, Java 21)?
#41What is the difference between JDK, JRE, and JVM?
#42How does the JIT (Just-In-Time) compiler work?
#43What is the difference between minor GC, major GC, and full GC?
#44What tools do you use to diagnose JVM memory issues?
#45What is the String pool and how does string interning work?
#46What is type erasure in Java generics?
#47What is the difference between <? extends T> and <? super T>?
#48What are sealed classes (Java 17)?
#49What is pattern matching for instanceof (Java 16)?
#50What are text blocks (Java 15)?
#51What is the difference between map() and flatMap() in streams?
#52What are method references in Java 8?
#53What is the difference between Comparable and Comparator?
#54What is Stream.collect() and what are common Collectors?
#55What is try-with-resources and how does it work?
#56What is the difference between throw and throws?
#57What is exception chaining and why is it important?
#58What is the difference between Java IO and NIO?
#59What is Java Serialization and what are its pitfalls?
#60What is reflection in Java and when is it used?
#61What is the difference between deep copy and shallow copy?
#62What is autoboxing and unboxing? What are the performance implications?
#63What are enums in Java and what advanced features do they support?
#64What is the difference between static and instance initializer blocks?
#65What is the difference between String.format() and String.formatted()?
#66What is the var keyword (Java 10) and when should you use it?
#67What are Java modules (Java 9 — JPMS)?
#68What is the difference between an inner class, static nested class, and anonymous class?
#69What are the new switch expressions (Java 14)?
#70What is the difference between Runnable, Callable, and Future?
#71What is the difference between String.equals() and String.equalsIgnoreCase()?
#72What is the difference between Iterator and ListIterator?
#73What is the difference between abstract class and concrete class?
#74How do you handle NullPointerException in Java?
#75What is the Collections utility class? What are its most important methods?
#76What is the difference between Deque and Queue?
#77What is a WeakHashMap and when would you use it?
#78What is the difference between checked and unchecked exceptions — best practices for APIs?
#79What is the ternary operator and the null-coalescing equivalent in Java?
#80What is the difference between == null check and Objects.isNull()?
#81What is the difference between interface default methods and abstract class methods?
#82What is the difference between Iterable and Iterator?
#83What are the best practices for writing clean Java code?
#84What is the difference between a process and a thread in Java?
#85What is a race condition and how do you prevent it?
#86What is the difference between HashMap.computeIfAbsent() and getOrDefault()?
#87What is the purpose of the transient keyword?
#88What is method hiding in Java?
#89What is the difference between i++ and ++i in Java?
#90What are the Java 8 Date/Time APIs and why were they introduced?
#91What is the difference between HashMap.put() and HashMap.putIfAbsent()?
#92What is the difference between String.valueOf() and toString()?
#93What is an immutable class and how do you create one?
#94What is the covariant return type in Java?
#95What is the difference between static and instance methods?
#96What is the difference between Predicate.and(), Predicate.or(), and Predicate.negate()?
#97What is the Observer pattern and how is it implemented in Java?
#98What is the Strategy pattern in Java?
#99What is String.intern() and when should you use it?
#100What are the key differences between Java 8, 11, 17, and 21?
#101What is auto-configuration in Spring Boot?
#102What is @SpringBootApplication and what does it do?
#103What is IoC (Inversion of Control) and Dependency Injection?
#104What is the difference between @Component, @Service, and @Repository?
#105What is the difference between @Controller and @RestController?
#106Explain @Transactional and its propagation levels.
#107How does Spring Boot handle exceptions globally?
#108What is Spring Boot Actuator?
#109What is the difference between @Bean and @Component?
#110Explain Spring Bean scopes.
#111What is Spring AOP and where is it used?
#112What is circular dependency and how do you fix it?
#113How do you configure Spring profiles?
#114How does Spring Security authentication work?
#115What is @Async in Spring Boot and how does it work?
#116What is Spring Data JPA and how does it simplify data access?
#117How does Spring Boot externalized configuration work?
#118What is Spring Cache Abstraction and how do you use it?
#119What are Spring Boot starters and why are they useful?
#120How do you write integration tests in Spring Boot?
#121What is the Spring ApplicationContext and how does it differ from BeanFactory?
#122What is a BeanPostProcessor and when would you use it?
#123What is the @PostConstruct and @PreDestroy lifecycle?
#124What is @Qualifier and when do you need it?
#125How does Spring Boot auto-configuration work under the hood?
#126What is @ConfigurationProperties and how does it differ from @Value?
#127What is Spring Boot's embedded server and how do you switch from Tomcat to Undertow?
#128What is Spring's @EventListener and ApplicationEvent?
#129What is @Conditional and how do you create custom conditions?
#130What is Spring Boot DevTools?
#131What is the difference between @RequestParam, @PathVariable, and @RequestBody?
#132How do you implement request validation in Spring Boot?
#133What is ResponseEntity and when should you use it?
#134What is content negotiation in Spring MVC?
#135How do you implement pagination and sorting in Spring Boot?
#136What is HATEOAS and does Spring Boot support it?
#137How do you version a REST API in Spring Boot?
#138What is the difference between findById() and getById() in Spring Data JPA?
#139What are JPA entity states (Transient, Managed, Detached, Removed)?
#140What is the difference between @OneToMany with fetch LAZY vs EAGER?
#141What is Hibernate first-level cache and second-level cache?
#142What is the Open Session in View (OSIV) pattern and why is it controversial?
#143What is a Spring Data JPA Specification and when would you use it?
#144What is CSRF and how does Spring Security handle it?
#145How do you implement JWT authentication in Spring Boot?
#146What is the difference between @Secured, @PreAuthorize, and @RolesAllowed?
#147What is CORS and how do you configure it in Spring Boot?
#148What is OAuth2 and how does Spring Security support it?
#149What is MockMvc and how do you use it?
#150What is @MockBean vs @Mock in Spring Boot tests?
#151What is @DataJpaTest and how does it differ from @SpringBootTest?
#152What is Testcontainers and how does it improve Spring Boot tests?
#153What is Micrometer and how does it integrate with Spring Boot Actuator?
#154How do you implement custom health indicators in Spring Boot?
#155How do you implement distributed tracing in Spring Boot?
#156What is graceful shutdown in Spring Boot and how do you configure it?
#157What is a Filter vs HandlerInterceptor in Spring Boot?
#158What is @ControllerAdvice and how does it work?
#159What is Spring WebFlux and how does it differ from Spring MVC?
#160What is Spring's @Scheduled and how do you configure it?
#161What happens during Spring Boot startup?
#162What is CommandLineRunner and ApplicationRunner?
#163What is Spring Boot's banner and how can you customize it?
#164What is Spring Boot's fat JAR and how is it structured?
#165What is Spring Retry and how do you use it?
#166What is Spring Integration vs Spring Batch?
#167What is @Transactional readOnly = true and what does it optimize?
#168What is the difference between Spring @Repository exception translation and JDBC exceptions?
#169How do you handle file uploads in Spring Boot?
#170What is the difference between @RequestMapping and specific mapping annotations?
#171What is Spring Cloud and its key components?
#172What is the difference between @Transactional on a class vs a method?
#173What is Spring Boot's connection pool? How do you tune HikariCP?
#174What is Spring Boot's auto-configuration for messaging (RabbitMQ / Kafka)?
#175What is Spring's @Lookup annotation?
#176What is Spring Security's method security and how is it different from URL security?
#177How does Spring Boot handle environment-specific properties?
#178What is the purpose of @EnableJpaAuditing?
#179How do you implement rate limiting in Spring Boot?
#180What is the difference between eager and lazy initialization in Spring Boot?
#181What is Spring Boot's support for caching with Redis?
#182What is Spring Boot's support for MongoDB?
#183What is @Transactional self-invocation problem and how do you fix it?
#184What is the difference between @Valid and @Validated in Spring?
#185What is Spring Boot's support for scheduled tasks with Quartz?
#186What is Spring Data REST and how does it differ from Spring MVC?
#187What is the difference between @Inject and @Autowired?
#188What is Flyway and how does it integrate with Spring Boot?
#189What is Spring Boot's support for WebSockets?
#190How do you implement a multi-tenant application in Spring Boot?
#191What are Spring Boot's management endpoints and how do you secure them?
#192What is Spring Boot's support for R2DBC (reactive database access)?
#193How do you implement idempotency in Spring Boot APIs?
#194What is Spring Boot's support for virtual threads (Java 21)?
#195What is Spring Boot's Docker image building support?
#196What is GraalVM native image and Spring Boot AOT support?
#197What is the difference between @SpringBootTest(webEnvironment) options?
#198What is Spring Boot's support for SSE (Server-Sent Events)?
#199What is Resilience4j and how does it integrate with Spring Boot?
#200What are best practices for Spring Boot application performance tuning?
#201What is the difference between horizontal and vertical scaling?
#202Explain the CAP theorem.
#203What is consistent hashing and why is it used?
#204What is database sharding and how does it work?
#205Explain cache invalidation strategies.
#206How would you design a URL shortener (like bit.ly)?
#207What is the Saga pattern in microservices?
#208What is CQRS and when should you use it?
#209What are rate limiting algorithms?
#210What is the Circuit Breaker pattern?
#211How do you design for high availability?
#212What is eventual consistency?
#213What is a message queue and when should you use one?
#214What is the difference between SQL and NoSQL databases?
#215What is a CDN and how does it improve performance?
#216How do you handle distributed transactions without 2PC?
#217How would you design a notification system (push, email, SMS)?
#218What is the difference between REST and gRPC?
#219What is the Outbox Pattern?
#220How do you design a distributed cache layer?
#221What is the difference between synchronous and asynchronous communication in microservices?
#222How do you design a notification system that sends 100M notifications per day?
#223What are the different types of database indexes and when do you use each?
#224How would you design a URL shortener like bit.ly?
#225What is eventual consistency and how do you handle it in practice?
#226How do you design a search system at scale?
#227What is the difference between optimistic and pessimistic locking?
#228How would you design a real-time leaderboard?
#229What is a write-ahead log (WAL) and how is it used?
#230How do you handle distributed transactions across microservices?
#231How do you design a chat application like WhatsApp?
#232What is a service mesh and when should you use one?
#233How would you design a video streaming platform like YouTube?
#234What is the difference between a load balancer and an API gateway?
#235How do you prevent and handle cascading failures in distributed systems?
#236What is the difference between a message queue and a message broker?
#237How do you design a rate limiter for an API?
#238What is the difference between replication and partitioning in databases?
#239How would you design Twitter's news feed?
#240What is observability and what are its three pillars?
#241What is the difference between SQL and NoSQL databases?
#242How do you implement idempotency in APIs?
#243How would you design a distributed job scheduler?
#244What is the Saga pattern vs 2PC for distributed transactions?
#245How do you design a file storage system like Dropbox?
#246What are the trade-offs of microservices vs monolithic architecture?
#247How does DNS work and how is it used in load balancing?
#248What is the strangler fig pattern?
#249How do you design an e-commerce inventory system that handles flash sales?
#250What is the difference between push and pull architectures for data?
#251What is a CDN and how does it work?
#252How do you design a fraud detection system?
#253What is event sourcing and how does it differ from CRUD?
#254How would you design a geospatial service like Uber's nearby driver system?
#255What is API versioning and what are the different strategies?
#256What is a Bloom filter and where is it used in system design?
#257How do you implement zero-downtime deployments?
#258What is the two-generals problem and what does it tell us about distributed systems?
#259How do you design a payment processing system?
#260What are the key principles of the SOLID design principles?
#261How would you design an autocomplete system?
#262What is backpressure and how do you handle it?
#263What is a time-series database and when should you use one?
#264What is a circuit breaker and how do you implement it?
#265How do you handle database migrations safely in production?
#266What is the CQRS pattern?
#267How do you secure an API at the architecture level?
#268What is the difference between synchronous replication and asynchronous replication?
#269How do you design a system for billions of events per day (analytics pipeline)?
#270What is chaos engineering and how do you implement it?
#271What is the database connection pool and how do you tune it?
#272How do you design an access control system?
#273How would you design an online code execution system like LeetCode?
#274What are SLOs, SLIs, and SLAs?
#275How does the request flow work in a typical microservices architecture?
#276What is a hot partition problem and how do you solve it?
#277How do you design a multi-tenant SaaS architecture?
#278What is tail latency and why does it matter?
#279What is the difference between availability and reliability?
#280How do you design a global, low-latency key-value store?
#281What is the N+1 query problem and how do you fix it?
#282How would you design a booking system like Airbnb?
#283What is the difference between a forward proxy and a reverse proxy?
#284What is the difference between stateful and stateless services?
#285How do you design a recommendation system?
#286What is the read-your-own-writes consistency guarantee?
#287How do you design a search-as-you-type / typeahead feature?
#288What is the difference between gRPC unary, server streaming, client streaming, and bidirectional streaming?
#289How do you handle large file uploads efficiently?
#290What are the key considerations when designing for high write throughput?
#291What is the difference between monolithic and microservices deployment strategies?
#292How do you design for disaster recovery?
#293What is the thundering herd problem?
#294What is a vector clock and how does it work?
#295What is the difference between a monorepo and polyrepo?
#296How do you ensure data consistency across microservices?
#297What is the difference between a batch job and a stream processing job?
#298How do you design an API for mobile clients vs web clients?
#299What is the role of a message broker in event-driven architecture?
#300How do you approach capacity planning for a new system?
#301What are the different types of SQL JOINs?
#302How does indexing work in MySQL (InnoDB)?
#303What is a covering index?
#304What are MySQL transaction isolation levels?
#305What is MVCC (Multi-Version Concurrency Control) in InnoDB?
#306How do you use EXPLAIN to analyze a query?
#307What are window functions in SQL?
#308What are CTEs (Common Table Expressions) and when should you use them?
#309What is the N+1 query problem and how do you fix it?
#310What is a deadlock in MySQL and how does it occur?
#311What is the difference between DELETE, TRUNCATE, and DROP?
#312How do you optimize a slow MySQL query?
#313What is database normalization?
#314What is MySQL replication and how does it work?
#315What is partitioning in MySQL?
#316What is GROUP BY vs HAVING in SQL?
#317What is a stored procedure and when should you use it?
#318How does the InnoDB storage engine handle locking?
#319What is the difference between UNION and UNION ALL?
#320How do you design a schema for a multi-tenant SaaS application?
#321What is the difference between a clustered and a non-clustered index?
#322How does MySQL handle AUTO_INCREMENT?
#323What are covering indexes and how do they improve performance?
#324What is the EXPLAIN output and how do you read it?
#325What are database triggers and when should you avoid them?
#326What is a foreign key constraint and what are its performance implications?
#327What is the difference between CHAR and VARCHAR?
#328How do you implement full-text search in MySQL?
#329What is the difference between MyISAM and InnoDB?
#330How does MySQL replication work and what are its modes?
#331What is a deadlock in MySQL and how does InnoDB handle it?
#332What are MySQL stored procedures and when should you use them?
#333How do you perform a slow query analysis in MySQL?
#334What is InnoDB buffer pool and how do you size it?
#335What is the difference between HAVING and WHERE?
#336What is MySQL's query cache and why was it removed?
#337How do you back up a MySQL database without downtime?
#338What is the difference between optimistic and pessimistic locking in MySQL?
#339What are MySQL partitioning types and when do you use them?
#340How do you handle large data migrations in production?
#341What is the difference between IN, EXISTS, and JOIN for subqueries?
#342What is the InnoDB redo log and undo log?
#343How do you implement pagination in MySQL efficiently?
#344What are the different types of JOINs in MySQL?
#345What is group replication and InnoDB Cluster?
#346What is the difference between a view and a materialized view?
#347How does MySQL's optimizer choose an execution plan?
#348What are common MySQL performance anti-patterns?
#349What is a generated column in MySQL?
#350What are the best practices for MySQL schema design?
#351How do you use MySQL's JSON column type?
#352What is the difference between transaction isolation levels in MySQL?
#353How do you handle hierarchical data in MySQL?
#354What is ProxySQL and how is it used?
#355What is MVCC and how does InnoDB implement it?
#356How do you detect and fix index fragmentation in MySQL?
#357What are the MySQL 8.0 improvements over MySQL 5.7?
#358How do you design a schema for audit logging?
#359What is binlog and how is it used for CDC?
#360How do you use MySQL's performance_schema?
#361What is the difference between COUNT(*), COUNT(1), and COUNT(col)?
#362What is a composite index and how should you order columns?
#363How do you implement soft delete in MySQL?
#364What is the difference between CHAR, VARCHAR, TEXT, and BLOB?
#365How does MySQL handle concurrent writes to the same row?
#366What is the difference between schema-on-write and schema-on-read?
#367How do you handle time zones in MySQL?
#368What is the difference between a unique constraint and a unique index?
#369How do you monitor MySQL in production?
#370What are window functions and how do you use them?
#371How do you implement row-level security in MySQL?
#372What is the difference between a primary key and a unique key?
#373How do you use MySQL's event scheduler?
#374What is the EXPLAIN ANALYZE command?
#375How do you handle database connection failures in application code?
#376What is the MySQL query execution order?
#377How do you scale MySQL reads?
#378What is the difference between row-based and statement-based replication?
#379How do you use CTEs (Common Table Expressions) effectively?
#380What is the difference between TRUNCATE, DELETE, and DROP?
#381How do you implement optimistic locking with versioning in MySQL?
#382What are the different ways to copy a table in MySQL?
#383What is the purpose of the information_schema?
#384What is innodb_flush_log_at_trx_commit and how does it affect durability?
#385How do you implement full-table search across millions of rows efficiently?
#386What is the max_connections parameter and how do you tune it?
#387What is a spatial index in MySQL and how is it used?
#388What is the difference between ROLLUP and CUBE in SQL?
#389How do you handle NULL values in MySQL queries?
#390What is the difference between a read and a write transaction?
#391How do you implement a queue in MySQL?
#392What is the mysql.user table and how does MySQL authentication work?
#393What is index merge optimization?
#394How do you detect and resolve replication lag?
#395What is the difference between MyISAM and InnoDB row format?
#396How do you implement rate limiting at the database level?
#397What is the difference between REPEATABLE READ and READ COMMITTED in practice?
#398What are MySQL's data types for storing money?
#399How do you handle schema evolution in a microservices environment?
#400What is the difference between DATETIME and TIMESTAMP in MySQL?