The most complete collection of Java interview clearance cheats in 2018 3

1. Basic questions

How to resolve Hash conflicts; (open address method, chain address method, re-hash method, establish public overflow area, etc.)

Write a pseudo code that will inevitably lead to deadlock;

Design patterns involved in Spring IoC; (factory pattern, simple interest pattern...)

When toString() method needs to be rewritten;

When judging objects are equal, under what circumstances only need to rewrite equals(), and under what circumstances need to rewrite equals(), hashcode()?

Why can't the elements stored in the set be repeated, and how is it guaranteed and implemented internally?

How to ensure the consistency of the distributed cache (distributed cache consistent hash algorithm?)? Distributed session implementation?

What are the benefits of Java 8 streaming iteration?

What features of the JDK used in the project?

Tell me about the realization principle of TreeMap? The nature of the red-black tree? What are the red-black tree traversal methods? How to resolve key conflicts? When is the setColor() method used? When will rotation and color conversion take place?

When is the Spring bean creation time? When is dependency injection?

The time complexity of deleting an element of ArrayList and LinkList; (ArrayList is O(N), LinkList is O(1));

What is CopyOnWriteArrayList;

How to implement serialization and deserialization (ObjectOutputStream, ObjectInputStream, readObject writeObject);

How to debug multi-threaded programs;

What happens if a thread calls start twice in succession? (Because the state is only ready, blocking, and executing, the state cannot be converted from execution to execution, so an illegal state will be reported!)

When is the time complexity of HashMap O(1), when is O(n), and when is O(logn);

Can the wait method be rewritten? (Wait is of the final type and cannot be overridden, not only that, notify and notifyall are both final), can wait be interrupted;

A Controller calls two Services, and both Services call two Dao respectively. How many database connection pool connections are used?

2. Network foundation

The difference and connection between HTTP, TCP and UDP;

The advantages of TCP and UDP, know which successful cases of using UDP protocol;

What underlying protocols are used for TCP and UDP;

Maximum capacity of a single UDP message;

Maximum capacity of a single TCP message;

TCP header format, UDP header format;

How to deal with Server encountering SYN Flood;

How to prevent XSS in web development?

How to solve the problem of unpacking and sticking, if our bag does not have a fixed length, how should our application solve it;

Three, operating system

Why memory alignment;

Why are there big-endian and little-endian, htol functions;

What is the meaning of the system information displayed by top; (important!)

Linux address space, how to address;

How does Linux find directories or files;

Four, distributed other

Distributed dilemma brought by sub-database and sub-meter and countermeasures;

How does Solr implement index updates 24 hours a day;

Five, Redis

Redis slot allocation (the effective part of the key uses the CRC16 algorithm to calculate the hash value, and then takes the remainder of the hash value to 16384 to obtain the slot value);

How to choose Redis master and slave (one is to switch actively, the other is to use sentinel automatic method);

Redis replication process;

Redis queue application scenarios;

What to do if the Redis master node is down, and what to do if there is still data that is not synchronized;

Six, system design open issues

Spike system design, how to oversell;

How do you store your pictures, and how do you store the information of the pictures when they are in the database?

If there is no fire station in Chengdu, now you are asked how many fire stations you want to build, how many fire officers and soldiers each fire station needs, and how many fire trucks, please come up with a plan;

Implement a circular blocking queue based on an array;

The common display form of ipv4 address is "168.0.0.1", please realize the mutual conversion between ip address and int type. (Use displacement method)

A certain service on the live network is deployed on multiple Liunx servers. One of them suddenly has a CPU 100%, while the other servers are normal. Please list the possible reasons for this situation? If you encounter such a situation, how should you position it? RAM? CPU? release? debug? Request volume?

Seven, the problem of large data volume (there will be a separate discussion later)

Given two files a and b, each stores 5 billion urls, each url occupies 64 bytes each, and the memory limit is 4G, let you find the common url of a and b files?

Mass log data, extract the IP with the most visits to Baidu on a certain day;

A text file has about ten thousand lines, each line contains one word. It is required to count the top 10 words that appear most frequently. Please give your thoughts and time complexity analysis.

There will be a special article to discuss this topic. If you have a small partner who can't wait, you can refer to:

1、https://blog.csdn.net/v_july_v/article/details/6279498

2、https://blog.csdn.net/v_july_v/article/details/7382693

Eight, logical thinking questions

There are two incense sticks of uniform thickness (incense for burning incense and worshiping Buddha), and each one takes an hour to burn. How can we get 15 minutes?

Suppose you have 8 pool balls, one of which is slightly heavier than the others. If you can only use the balance to determine which ball is heavier, how many times do you need to weigh the heavier ball? (2 times);

There are 1,000 identical bottles in the laboratory, but one of them is poisonous. You can use a laboratory mouse to test which bottle is poison. If the mouse drinks the poison, it will die within a week, and the potions in the other bottles have no side effects. May I ask how many mice can be used to find out which bottle is poison within a week; (the answer is 10)

Suppose there is a pond with infinite water in it. There are currently two empty kettles with capacities of 5 liters and 6 liters. The problem is how to get 3 liters of water from the pond using only these 2 kettles;

Guess you like

Origin blog.csdn.net/yipianfeng_ye/article/details/82386985