Baidu's first 200 pages of "Java Interview Questions" selected next article
Design Pattern
What are Design Patterns? Which design pattern have you used? In what occasions do you know which commercial design models do you use?
Which design patterns can increase the scalability of the system
Singleton mode
In addition to singleton mode, what other design modes have you used in a production environment?
Writing Singleton Singleton Mode Singleton Mode Double Check Lock How to Create a Thread-Safe Singleton
What is the singleton pattern of a class? Write three singleton pattern implementations
Adapter mode
When to use the Xiangyuan mode, when to use the combination mode. When to use the visitor mode. What is the template method mode. Please give an example of a design mode that conforms to the principle of opening and closing.
Open question
Summarize the characteristics of web programming in one sentence
How does Google return search results to users in one second? Which dependency injection method do you recommend using, constructor injection, or Setter method injection tree (binary or other) to form the basis for many ordinary data structures. Please describe some such data structures and when you can use them. How to design an online system suddenly becomes extremely slow. How do you find the problem? What kind of project is not suitable for using the framework? How does Sina Weibo implement pushing Weibo to subscribers? Brief introduction. What happens in Java Web applications from the browser to the time of entering the URL to the request interface. Please talk about how to safely modify the same line of data under SSH integration under high concurrency.
How to implement the ticket booking system of 12306 website, how to ensure that tickets will not be oversold, how to optimize the performance optimization of the website. Let’s talk about the server architecture that has been involved in the design. Please think about a solution to implement countDownLatch in a distributed environment.
Think about a solution to design an automatic adaptation of local cache that can control the overall size of the cache. The most difficult technical challenge in your career is how to write a design document, what is the capitalization of the O? Give a few examples how you consider some design principles in programming, such as the opening and closing principles, and the application at work. Explain the model and characteristics of network applications. Design an online document system. The document can be edited. How to prevent multiple people from editing and updating the same document at the same time. Say the working mechanism of the data connection pool. How to obtain the highest frequency of words appearing in a file. Describe your most commonly used programming style. If you have the opportunity to redesign your product, how do you do how to build a highly available system? How to start without entering a username and password. How to upload and download files in a Java-based web project. How to implement a flash sale system to ensure that only a few users can buy a certain product.
How to achieve load balancing, what algorithms can be used to design a shopping cart? Think about how Taobao’s shopping cart is implemented to design a set of high-concurrent payment solutions, how to design the architecture, how to design and establish and maintain a long connection of 100w, and how to avoid browser cache.
How to prevent cache avalanche If AB and two systems depend on each other, how to undo the dependency if someone maliciously creates illegal connections, how to solve the problem if there are billions of whitelists, high concurrent queries are required every day during the day, and update them at night. How to design this function. If the system wants to use super-large integers (more than the long length range), please design a data structure to store such super-large numbers and design an algorithm to implement super-large integer addition operations)
If you want to design a graphics system, please design a simple implementation of basic graphics components (Point, Line, Rectangle, Triangle). If you are allowed to implement a concurrent and secure linked list, how will you make the difference between an application server and a WEB server? How to monitor performance of application servers and the differences between various methods? What large websites have you used for application server optimization technology? Which architecture should be considered by large websites? Have you dealt with online problems? Memory leaks, CPU utilization is high, what books do you think you are doing when the application is unresponsive? What are the most impressive books? What are the common reconstruction techniques you use under the description of what version management tools do you use? What is the difference between branch and tag? Have you learned about what anti-patterns exist? What are the techniques for front-end optimization of websites you have used? How to analyze Thread dump
How do you understand the concepts of joinpoint, pointcut, enhancement, introduction, weaving, and section in AOP. How do you deal with memory leaks or stack overflow problems? What are the JVM parameters used online? How to improve the QPS and throughput of the system?
Knowledge
Explain what MESI protocol is (cache coherence)
Talk about reactor model
What new features does Java 9 bring
Comparing Java and C++, the simple principles and applications of exception handling mechanisms in C++ or Java briefly talk about the Tomcat structure and what is the virtual memory of its class loader process. Please briefly explain your understanding of test-driven development (TDD)
CDN implementation principle
What is the difference between Maven and ANT
What are the commonly used pictures in UML
Linux
What is N+1 puzzle What is paxos algorithm What is restful? Tell me what you understand restful
What is the zab protocol and what is the domain model? What is the difference between anemia model and a congestion model? What is domain-driven development?
Introduction to the Web Service framework in the Java field you understand
What is the difference between Web Server, Web Container and Application Server? Where does the difference between microservices and Monolithic Applications describe the role of cookies and sessions, the differences and their respective application scopes, the working principle of Session What are the Continuous Integration and Static Code Analysis tools you use briefly describe database regularization (Normalizations)
What do the principles of KISS, DRY, YAGNI, etc. mean the principles of distributed transactions, advantages and disadvantages, and how to use distributed transactions?
How to achieve unique serial number in a distributed cluster
network
Have you seen some of the framework's code persistence layer designs, what are the issues to consider? What are the numerical enhancements of the persistence layer framework you have used? Can you explain the Liszc replacement principle? How did you test an application? What are the common programming protocols for the transport layer of testing frameworks? And tell their own characteristics
Programming questions
Calculate overtime fees
Overtime pay for overtime work under 10 hours is 1.5 times the hourly salary. Working overtime for 10 hours or more is calculated as 4 yuan per hour. Tip: (Working 26 days a month, working 8 hours a day)
Calculate monthly salary of 1000, calculate overtime pay for 9 hours overtime, calculate 2500 monthly salary of 11 hours overtime, calculate 1000 monthly salary of 15 hours overtime
Sell things
A mall has red apples and green apples for sale. (Red apples are 5 yuan per piece, green apples are 4 yuan per piece).
Simulate a purchase. 200 red apples and green apples were each added.
Simulate a for sale. I bought 10 red apples and green apples each. Each Apple sold requires statistics.
Tip: An apple is a separate entity.
Date extraction
There is such a time string: 2008-8-8 20:08:08 , please write a regular expression that can match it, and write Java code to extract the hours, minutes and seconds after the date, that is: 20:08:08
Thread
8 design 4 threads, two threads increase by 1 each time for j, and the other two threads decrease by 1 each time for j. Write out the program.
Write a multi-threaded program in Java, such as writing four threads, two plus one, two decrement one by one, and output
wait-notify writes a piece of code to solve producer-consumer problems
number
Determine how many prime numbers are between 101 and 200, and output all prime numbers. Use the most efficient method to calculate 2 times 17 to equal 100 million numbers. 2 of them are repeated. Find it quickly, and the time and space must be optimal.
200 million randomly generated unordered integers to find the value of the intermediate size
Find the smallest 10 out of 1 billion numbers
Natural numbers from 1 to 100 million, find the sum of the split numbers of all numbers, such as 286 split into 2, 8, 6, such as the sum of the split numbers from 1 to 11 => 1 + … + 9 + 1 + 0 + 1 + 1
If a number is exactly equal to the sum of its factors, this number is called "finished number". For example, 6=1+2+3. Programming to find out all the elements within 1000 and all the elements in an array appear three times, and only one element appears once. Find this element, a ball falls freely from a height of 100 meters, and rebounds back to half of the original height after each landing; fall again, find out how many meters it passes when it lands on the 10th time? How high is the 10th rebound?
Find the sum of prime numbers within 100-1000 and find the average number of sums from 1 to 100 to find the value of s=a+a+aaa+aaaa+aaa…a, where a is a number. For example, 2+22+222+2222+2222 (A total of 5 numbers are added), and the addition of several numbers is controlled by keyboard. Find the sum of 1 to 100
Calculate the prime numbers from 1 to 40 and put them in the array
There are 3n+1 numbers, of which 3n are repeated, and only 1 is not repeated, how to find it.
There is a set of numbers 1.1.2.3.5.8.13.21.34. Write a program and enter a number at will to give the factorial development of the first 5 numbers with the same rules as the previous set of numbers. Fizz Buzz
Given an array containing N integers, find out the missing integers and sort out the array, find out all combinations with the sum of the two numbers m to decompose a positive integer to the prime factor. For example: enter 90 and print out 90=2*3*3*5.
Print out all the "Narcissus Number", the so-called "Narcissus Number" refers to a three-digit number whose digits are cubic sum equal to the number itself. For example: 153 is a "dazzling number", because 153=1 cubic power +5 cubic power +3 cubic power exchange values of two variables in place to find the median of 4 byte integers and find the square root of the integer to realize Fibonacci
network
Programming with Java Socket, reading a few characters on the server, and then writing to the local display
reflection
What functions does the reflection mechanism provide?
How to implement reflection Where to use reflection mechanism? Reflection. Class.forName and ClassLoader. The three ways to differentiate reflection. What are the three ways to create class instances? How to call an object through reflection. How to obtain and set the value of the object's private fields through reflection. Advantages and disadvantages of the reflection mechanism.
database
Write a JDBC to Oracle program and implement data query
algorithm
50 people sit around in a circle, when the number reaches a multiple of three or three, ask who the remaining person is, what is the original position? Implement an elevator simulator. Write a bubble sort and write a fold and half lookup randomly generates 20 characters that cannot be repeated and sorts. Write a function, pass in 2 ordered integer arrays, return an ordered integer array and write a piece of code to remove an element when traversing the ArrayList. Classical question: There is a pair of rabbits, and a pair of rabbits are born every month from the third month after birth. The little rabbit grows to the fourth month and has another pair of rabbits every month. If the rabbits do not die, ask how many rabbits are in total in each month.
Regular
Please write a regular expression matching the IP address and write a regular expression to determine whether a string is a number
String
Write a method, enter a file name and a string, and count the number of times this string appears in this file.
Write a program to find out the combination of all strings, and check whether they are palindrome strings. Write a string inversion function, enter abcde to convert it into edcba code mini game, reverse the words in the sentence to convert the GB2312 encoded string into ISO-8859-1 encoded string. Please write a piece of code to calculate the number of characters "A" in a given text. Write a function that intercepts strings in iteration and recursion respectively. The input is a string and byte number, and the output is a string intercepted by bytes. However, you must ensure that the Chinese characters are not cut off half. For example, "I ABC" 4 should be cut off as "I AB", enter "I ABC Chinese DEF", 6 should be output as "I ABC" instead of "I ABC+Half of Chinese"
Given 2 files containing a word list (one per line), programmatically list the intersection and print out all the permutations of a string to convert the numbers input by a keyboard into Chinese output (for example: input 1234567, output: 122 pick 34566 pick 7)
During the development of web application, we often encounter characters that output some kind of encoded characters, such as from GBK to ISO8859-1, etc. How to output a certain kind of encoded character string
date
Calculate the gap between two dates
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.