Essential Java Interview Questions: Core, Networking, OS, Distributed & Big Data
Compiled from extensive interview experiences, this guide presents a comprehensive set of Java interview questions spanning core language concepts, data structures, concurrency, Spring IoC, networking fundamentals, operating system principles, distributed system challenges, Redis mechanisms, system design scenarios, big‑data problem solving, and classic logical puzzles.
Fundamental Questions
How to resolve hash collisions (open addressing, chaining, rehashing, overflow area).
Write pseudo‑code that inevitably causes a deadlock.
Design patterns involved in Spring IoC (Factory, Singleton, etc.).
When should the toString() method be overridden?
When is it enough to override equals() only, and when must hashCode() be overridden as well?
Why can elements in a Set not be duplicated and how is this enforced internally?
How to ensure consistency of distributed caches (consistent‑hash algorithm) and implement distributed sessions?
Benefits of Java 8 stream iteration.
Key JDK features used in projects.
Implementation principles of TreeMap, properties of red‑black trees, traversal methods, key‑collision handling, usage of setColor(), and when rotations/color changes occur.
When are Spring beans created and when does dependency injection occur?
Time complexity of deleting an element in ArrayList vs. LinkedList (O(N) vs. O(1)).
What is CopyOnWriteArrayList?
How serialization and deserialization work internally (ObjectOutputStream, ObjectInputStream, readObject, writeObject).
How to debug multithreaded programs.
What happens if start() is called twice on the same thread?
When does HashMap have O(1), O(N), or O(log N) time complexity?
Can the wait() method be overridden or interrupted?
How many database connection pools are used when a controller calls two services, each calling two DAOs?
Network Basics
Differences and relationships among HTTP, TCP, and UDP.
Advantages of TCP vs. UDP and real‑world UDP use cases.
Underlying protocols used by TCP and UDP.
Maximum payload size of a single UDP packet.
Maximum payload size of a single TCP packet.
TCP and UDP header formats.
How to handle a SYN‑Flood attack on a server.
Methods to prevent XSS in web development.
Issues of packet fragmentation and reassembly (sticky packets) and solutions when packet length is not fixed.
Operating System
Why memory alignment is necessary.
Reasons for big‑endian vs. little‑endian and the role of functions like htons/ntohl.
Meanings of the information displayed by the top command.
How Linux address space works and how addressing is performed.
How Linux searches for directories or files.
Distributed Topics
Challenges and solutions caused by sharding databases (horizontal partitioning) and tables.
How Solr achieves 24‑hour continuous index updates.
Redis
Redis slot allocation using CRC16 and modulo 16384.
Redis master‑slave selection methods (active switch vs. Sentinel).
Redis replication process.
Use cases for Redis queues.
Handling master node failure and data synchronization.
System Design Open Questions
Designing a flash‑sale system and preventing overselling.
How to store images and record image metadata in a database.
Planning the number and resources of fire stations for a city without any.
Implement a circular blocking queue using an array.
Convert IPv4 address strings to integers and back using bitwise operations.
Diagnosing a Linux server that spikes to 100 % CPU while others are normal: possible causes and troubleshooting steps.
Big Data Problems
Given two files each containing 5 billion URLs (64 bytes each) and only 4 GB RAM, find the common URLs.
From massive log data, identify the IP with the highest number of visits to Baidu on a specific day.
Given a text file with ~10 000 lines each containing a word, list the top 10 most frequent words with time‑complexity analysis.
Logical Thinking Questions
Using two incense sticks that each burn for one hour, measure exactly 15 minutes.
With eight balls where one is slightly heavier, determine the heavier ball using a balance scale in two weighings.
From 1 000 identical bottles, one contains poison; using mice that die after a week, find the minimum number of mice needed to identify the poisonous bottle within a week.
Using only a 5‑liter and a 6‑liter jug, measure exactly 3 liters of water from an infinite source.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Backend Technology
Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
