Mastercard Interview Questions
Global payments technology company with major engineering hubs in Pune and Gurgaon. Interviews test Java, microservices, system design for high-throughput payment processing, and SQL. Security, fraud detection patterns, and API gateway design are common themes.
#1Explain the SOLID principles.
#2How does HashMap work internally?
#3What is the difference between HashMap and ConcurrentHashMap?
#4Explain Java Memory Model: Heap, Stack, and Metaspace.
#5What is the volatile keyword in Java?
#6What is the difference between synchronized and ReentrantLock?
#7What is a deadlock and how do you prevent it?
#8Explain the Stream API and intermediate vs terminal operations.
#9What is garbage collection? How does G1 differ from ZGC?
#10What is the Java ClassLoader hierarchy?
#11What are Java records (Java 16+)?
#12What is the Executor framework and when would you use it over raw Threads?
#13What is the difference between composition and inheritance?
#14What is a marker interface? Give examples.
#15What are the design patterns most commonly asked in Java interviews?
#16How do you implement a Singleton in Java correctly?
#17What is the contract between equals() and hashCode()?
#18What is the difference between fail-fast and fail-safe iterators?
#19What is CopyOnWriteArrayList and when should you use it?
#20How does PriorityQueue work and when would you use it?
#21What is the happens-before relationship in Java Memory Model?
#22What is the difference between sleep(), wait(), and yield()?
#23What are atomic classes (AtomicInteger, AtomicReference)? How do they work?
#24What is a CountDownLatch vs CyclicBarrier?
#25What is a ThreadLocal and what are its dangers?
#26What is a CompletableFuture and how does it improve async programming?
#27What are virtual threads (Project Loom, Java 21)?
#28How does the JIT (Just-In-Time) compiler work?
#29What is the difference between minor GC, major GC, and full GC?
#30What tools do you use to diagnose JVM memory issues?
#31What is the String pool and how does string interning work?
#32What is type erasure in Java generics?
#33What is the difference between <? extends T> and <? super T>?
#34What are sealed classes (Java 17)?
#35What is pattern matching for instanceof (Java 16)?
#36What is the difference between map() and flatMap() in streams?
#37What is the difference between Comparable and Comparator?
#38What is Stream.collect() and what are common Collectors?
#39What is try-with-resources and how does it work?
#40What is exception chaining and why is it important?
#41What is the difference between Java IO and NIO?
#42What is Java Serialization and what are its pitfalls?
#43What is reflection in Java and when is it used?
#44What is the difference between deep copy and shallow copy?
#45What is autoboxing and unboxing? What are the performance implications?
#46What are enums in Java and what advanced features do they support?
#47What is the difference between static and instance initializer blocks?
#48What are Java modules (Java 9 — JPMS)?
#49What is the difference between an inner class, static nested class, and anonymous class?
#50What are the new switch expressions (Java 14)?
#51What is the difference between Runnable, Callable, and Future?
#52How do you handle NullPointerException in Java?
#53What is the difference between Deque and Queue?
#54What is a WeakHashMap and when would you use it?
#55What is the difference between checked and unchecked exceptions — best practices for APIs?
#56What is the difference between interface default methods and abstract class methods?
#57What are the best practices for writing clean Java code?
#58What is a race condition and how do you prevent it?
#59What is the difference between HashMap.computeIfAbsent() and getOrDefault()?
#60What is the purpose of the transient keyword?
#61What is method hiding in Java?
#62What are the Java 8 Date/Time APIs and why were they introduced?
#63What is the difference between HashMap.put() and HashMap.putIfAbsent()?
#64What is an immutable class and how do you create one?
#65What is the covariant return type in Java?
#66What is the difference between Predicate.and(), Predicate.or(), and Predicate.negate()?
#67What is the Observer pattern and how is it implemented in Java?
#68What is the Strategy pattern in Java?
#69What is String.intern() and when should you use it?
#70What are the key differences between Java 8, 11, 17, and 21?
#71What is an API Gateway and what does it do?
#72How do microservices communicate?
#73What is service discovery in microservices?
#74What is the Circuit Breaker pattern and how does it prevent cascading failures?
#75What is distributed tracing and why is it important?
#76What is the Strangler Fig pattern for microservices migration?
#77What is a sidecar pattern?
#78How do you manage configuration in microservices?
#79What are the 12-Factor App principles?
#80What is event-driven architecture and when should you use it?
#81What is the difference between orchestration and choreography in Saga?
#82How do you test microservices effectively?
#83What is a service mesh and when should you use one?
#84How do you ensure data consistency across microservices?
#85What is the circuit breaker pattern?
#86What is service discovery and how does it work?
#87What is the Bulkhead pattern?
#88What is the Retry pattern and how do you implement it safely?
#89What is the difference between choreography and orchestration in Sagas?
#90What is the Backend for Frontend (BFF) pattern?
#91How do you implement distributed tracing?
#92What is the Strangler Fig pattern for migrating a monolith?
#93What is eventual consistency and how do you design for it?
#94How do you version microservice APIs?
#95What is the Sidecar pattern?
#96What is a dead letter queue and why is it important?
#97How do you implement health checks in microservices?
#98What is the Outbox pattern and how does it guarantee event delivery?
#99What is idempotency and how do you implement it in microservices?
#100What are the 12-Factor App principles?
#101How do you handle secrets management in microservices?
#102What is the Ambassador pattern in microservices?
#103How do you implement inter-service authentication?
#104What is the Throttling pattern and how does it differ from rate limiting?
#105What is CQRS and how does it apply to microservices?
#106How do you test microservices?
#107What is service isolation and why is it important?
#108What is an Event-Driven Architecture?
#109How do you handle database per service in practice?
#110What is the Role of API composition in microservices?
#111What is graceful degradation in microservices?
#112What is the Event Sourcing pattern?
#113How do you implement logging in a microservices environment?
#114What is the two-phase commit vs Saga for distributed transactions?
#115How do you handle timeouts in microservices?
#116What is the Scatter-Gather pattern?
#117What is the difference between a microservice and a nanoservice?
#118How do you implement canary deployments in microservices?
#119What is a Service Registry?
#120What is blue-green deployment and how does it work?
#121What is the Aggregator pattern?
#122How do microservices handle configuration management?
#123What is the Proxy pattern in microservices?
#124How do you implement distributed locking in microservices?
#125What is Kafka and why is it popular in microservices?
#126How do you manage service dependencies in microservices?
#127What is a bounded context?
#128How do you implement a request-reply pattern over async messaging?
#129What is the Token Bucket algorithm and how is it used for rate limiting?
#130How do you handle schema evolution in event-driven systems?
#131What is the difference between a monolith, microservices, and modular monolith?
#132What is the Choreography pattern in detail?
#133What is a composite microservice?
#134How do you deal with "chatty" microservices?
#135What is a process manager / workflow engine in microservices?
#136How do you implement zero-downtime deployments for microservices?
#137What is the Anti-Corruption Layer pattern?
#138What are the common pitfalls of microservices adoption?
#139What is the difference between orchestration and choreography?
#140How do you implement a consistent read across microservices?
#141What is load shedding?
#142What is the difference between gRPC and REST for inter-service communication?
#143What is the Gateway Aggregation pattern vs Gateway Routing?
#144What is the Inbox pattern?
#145How do you handle versioning of events in Kafka?
#146What is the Open Host Service pattern?
#147How do you implement service-level SLOs in microservices?
#148What is the Claim Check pattern?
#149What is service mesh traffic management?
#150What is the difference between horizontal and vertical scaling for microservices?
#151What is the role of a message schema registry?
#152How do you handle service discovery with Kubernetes?
#153How do you implement an API gateway from scratch?
#154What is consumer-driven contract testing (Pact)?
#155How do you use feature toggles in microservices?
#156What is polyglot persistence in microservices?
#157What are distributed caching strategies for microservices?
#158How do you design a CI/CD pipeline for microservices?
#159How do you implement observability with Micrometer, Prometheus, and Grafana?
#160What is the Retry pattern and when should you NOT retry?
#161How do you implement Saga compensation (rollback) in detail?
#162What is multi-tenancy in microservices and how do you implement it?
#163What are the steps to migrate a monolith to microservices using the Strangler Fig pattern?
#164How do you design microservices for failure?
#165What is data mesh and how does it relate to microservices data ownership?
#166What is a sidecar proxy and how does Envoy work?
#167How do you handle inter-service authorization (not just authentication)?
#168When should you NOT use microservices?
#169Explain the CAP theorem.
#170What is consistent hashing and why is it used?
#171What is database sharding and how does it work?
#172Explain cache invalidation strategies.
#173How would you design a URL shortener (like bit.ly)?
#174What is the Saga pattern in microservices?
#175What is CQRS and when should you use it?
#176What are rate limiting algorithms?
#177What is the Circuit Breaker pattern?
#178How do you design for high availability?
#179What is eventual consistency?
#180What is a message queue and when should you use one?
#181What is the difference between SQL and NoSQL databases?
#182How do you handle distributed transactions without 2PC?
#183How would you design a notification system (push, email, SMS)?
#184What is the difference between REST and gRPC?
#185What is the Outbox Pattern?
#186How do you design a distributed cache layer?
#187What is the difference between synchronous and asynchronous communication in microservices?
#188How do you design a notification system that sends 100M notifications per day?
#189What are the different types of database indexes and when do you use each?
#190How would you design a URL shortener like bit.ly?
#191What is eventual consistency and how do you handle it in practice?
#192How do you design a search system at scale?
#193What is the difference between optimistic and pessimistic locking?
#194How would you design a real-time leaderboard?
#195What is a write-ahead log (WAL) and how is it used?
#196How do you handle distributed transactions across microservices?
#197How do you design a chat application like WhatsApp?
#198What is a service mesh and when should you use one?
#199How would you design a video streaming platform like YouTube?
#200What is the difference between a load balancer and an API gateway?
#201How do you prevent and handle cascading failures in distributed systems?
#202What is the difference between a message queue and a message broker?
#203How do you design a rate limiter for an API?
#204What is the difference between replication and partitioning in databases?
#205How would you design Twitter's news feed?
#206What is observability and what are its three pillars?
#207How do you implement idempotency in APIs?
#208How would you design a distributed job scheduler?
#209What is the Saga pattern vs 2PC for distributed transactions?
#210How do you design a file storage system like Dropbox?
#211What are the trade-offs of microservices vs monolithic architecture?
#212How does DNS work and how is it used in load balancing?
#213What is the strangler fig pattern?
#214How do you design an e-commerce inventory system that handles flash sales?
#215What is the difference between push and pull architectures for data?
#216How do you design a fraud detection system?
#217What is event sourcing and how does it differ from CRUD?
#218How would you design a geospatial service like Uber's nearby driver system?
#219What is API versioning and what are the different strategies?
#220What is a Bloom filter and where is it used in system design?
#221How do you implement zero-downtime deployments?
#222What is the two-generals problem and what does it tell us about distributed systems?
#223How do you design a payment processing system?
#224How would you design an autocomplete system?
#225What is backpressure and how do you handle it?
#226What is a time-series database and when should you use one?
#227What is a circuit breaker and how do you implement it?
#228How do you handle database migrations safely in production?
#229What is the CQRS pattern?
#230How do you secure an API at the architecture level?
#231What is the difference between synchronous replication and asynchronous replication?
#232How do you design a system for billions of events per day (analytics pipeline)?
#233What is chaos engineering and how do you implement it?
#234What is the database connection pool and how do you tune it?
#235How do you design an access control system?
#236How would you design an online code execution system like LeetCode?
#237How does the request flow work in a typical microservices architecture?
#238What is a hot partition problem and how do you solve it?
#239How do you design a multi-tenant SaaS architecture?
#240What is tail latency and why does it matter?
#241How do you design a global, low-latency key-value store?
#242What is the N+1 query problem and how do you fix it?
#243How would you design a booking system like Airbnb?
#244How do you design a recommendation system?
#245What is the read-your-own-writes consistency guarantee?
#246How do you design a search-as-you-type / typeahead feature?
#247What is the difference between gRPC unary, server streaming, client streaming, and bidirectional streaming?
#248How do you handle large file uploads efficiently?
#249What are the key considerations when designing for high write throughput?
#250What is the difference between monolithic and microservices deployment strategies?
#251How do you design for disaster recovery?
#252What is the thundering herd problem?
#253What is a vector clock and how does it work?
#254What is the difference between a monorepo and polyrepo?
#255How do you ensure data consistency across microservices?
#256What is the difference between a batch job and a stream processing job?
#257How do you design an API for mobile clients vs web clients?
#258What is the role of a message broker in event-driven architecture?
#259How do you approach capacity planning for a new system?
#260How does indexing work in MySQL (InnoDB)?
#261What is a covering index?
#262What are MySQL transaction isolation levels?
#263What is MVCC (Multi-Version Concurrency Control) in InnoDB?
#264How do you use EXPLAIN to analyze a query?
#265What are window functions in SQL?
#266What are CTEs (Common Table Expressions) and when should you use them?
#267What is the N+1 query problem and how do you fix it?
#268What is a deadlock in MySQL and how does it occur?
#269How do you optimize a slow MySQL query?
#270What is database normalization?
#271What is MySQL replication and how does it work?
#272What is partitioning in MySQL?
#273What is a stored procedure and when should you use it?
#274How does the InnoDB storage engine handle locking?
#275How do you design a schema for a multi-tenant SaaS application?
#276What is the difference between a clustered and a non-clustered index?
#277What are covering indexes and how do they improve performance?
#278What is the EXPLAIN output and how do you read it?
#279What are database triggers and when should you avoid them?
#280What is a foreign key constraint and what are its performance implications?
#281How do you implement full-text search in MySQL?
#282How does MySQL replication work and what are its modes?
#283What is a deadlock in MySQL and how does InnoDB handle it?
#284What are MySQL stored procedures and when should you use them?
#285How do you perform a slow query analysis in MySQL?
#286What is InnoDB buffer pool and how do you size it?
#287What is MySQL's query cache and why was it removed?
#288How do you back up a MySQL database without downtime?
#289What is the difference between optimistic and pessimistic locking in MySQL?
#290What are MySQL partitioning types and when do you use them?
#291How do you handle large data migrations in production?
#292What is the difference between IN, EXISTS, and JOIN for subqueries?
#293What is the InnoDB redo log and undo log?
#294How do you implement pagination in MySQL efficiently?
#295What is group replication and InnoDB Cluster?
#296What is the difference between a view and a materialized view?
#297How does MySQL's optimizer choose an execution plan?
#298What are common MySQL performance anti-patterns?
#299What is a generated column in MySQL?
#300What are the best practices for MySQL schema design?
#301How do you use MySQL's JSON column type?
#302What is the difference between transaction isolation levels in MySQL?
#303How do you handle hierarchical data in MySQL?
#304What is ProxySQL and how is it used?
#305What is MVCC and how does InnoDB implement it?
#306How do you detect and fix index fragmentation in MySQL?
#307What are the MySQL 8.0 improvements over MySQL 5.7?
#308How do you design a schema for audit logging?
#309What is binlog and how is it used for CDC?
#310How do you use MySQL's performance_schema?
#311What is a composite index and how should you order columns?
#312How do you implement soft delete in MySQL?
#313How does MySQL handle concurrent writes to the same row?
#314What is the difference between schema-on-write and schema-on-read?
#315How do you handle time zones in MySQL?
#316How do you monitor MySQL in production?
#317What are window functions and how do you use them?
#318How do you implement row-level security in MySQL?
#319How do you use MySQL's event scheduler?
#320What is the EXPLAIN ANALYZE command?
#321How do you handle database connection failures in application code?
#322What is the MySQL query execution order?
#323How do you scale MySQL reads?
#324What is the difference between row-based and statement-based replication?
#325How do you use CTEs (Common Table Expressions) effectively?
#326How do you implement optimistic locking with versioning in MySQL?
#327What is the purpose of the information_schema?
#328What is innodb_flush_log_at_trx_commit and how does it affect durability?
#329How do you implement full-table search across millions of rows efficiently?
#330What is the max_connections parameter and how do you tune it?
#331What is a spatial index in MySQL and how is it used?
#332What is the difference between ROLLUP and CUBE in SQL?
#333How do you handle NULL values in MySQL queries?
#334What is the difference between a read and a write transaction?
#335How do you implement a queue in MySQL?
#336What is the mysql.user table and how does MySQL authentication work?
#337What is index merge optimization?
#338How do you detect and resolve replication lag?
#339What is the difference between MyISAM and InnoDB row format?
#340How do you implement rate limiting at the database level?
#341What is the difference between REPEATABLE READ and READ COMMITTED in practice?
#342What are MySQL's data types for storing money?
#343How do you handle schema evolution in a microservices environment?