1000 Java high-frequency interview questions (organized by Ali interviewer), escorting you to the golden nine silver ten

Many Java engineers have good skills, but they have a headache at the first interview. They were rejected in 9 out of 10 interviews, and they still went to an unknown small company.

The problem is this: the interview has skills, and you will not express your ability to the interviewer .

  • Fresh graduates : How do you prepare your resume, interview project and interview speech? What is the underlying logic of Spring?

  • Programmers with 1-3 years of experience : What valuable skills should you talk about in the interview? How can you best showcase your skills with these valuable technologies? What is the underlying logic of distributed components?

  • Programmers with 3-5 years of experience : How to build and practice k8s?

I believe that every Java programmer has encountered these problems, and even some people still don’t know how to solve them, and they have repeatedly failed, which eventually leads to a very low pass rate of your interview.

If your resume is your stepping stone to job hunting, then your skills and methods of answering every Java technology question are the key to whether you can pass the interview!

In order to help engineers master the skills of each question in the Java interview and improve the pass rate of the interview, here are some frequently asked interview questions that are frequently asked in the interviews of major companies. This interview question information includes Spring, JVM, and java basics. , Java Collections, Java Concurrent Programming, Microservices, Network, Kafka, Distributed, Redis, Dachang Interview Solutions, Distributed Transactions, Design Patterns, Algorithms, Data Structures, MySQL, etc.

Required skills for architects: (Ali interview must ask)

Multithreading & Concurrency Interview Questions:

JAVA concurrency knowledge base:

  • There are several ways to implement multithreading in Java

  • Inherit the Thread class

  • Implement the Runnable interface.

  • ExecutorSenvice.Callable.Future has return value Thread

  • Based on thread pool

  • 4 thread pools

  • How to stop a running thread

  • What is the difference between notify0 and notifyAll0?

  • What is the difference between sleep0 and wait0?

  • What is volatile? Can order be guaranteed?

  • What is the difference between start0 and run0 methods in Thread class?

  • Why are wait, notify and nfifAllI methods not in the thread class?

  • Why are the wait and ntify methods called in a synchronized block?

  • Difference between interrupted and isInterruptedd methods in Java?

  • What is the difference between synchronized and ReentrantLock in Java?

  • There are three threads T1, T2, T3, how to ensure sequential execution?

  • What is the difference between SynchronizedMap and ConcurrentHashMap?

  • What is thread safety

  • What does the yield method in the Thread class do?

  • What is the difference between the submit0 and execute0 methods in the Java thread pool?

  • Tell me about your understanding of the synchronized keyword

  • Tell me how you use the synchronized keyword. Have you used it in your project? What are the three main ways to use the synchronized keyword?

  • What is thread safety? Is Vector a thread safe class?

  • What does the volatile keyword do?

  • Briefly describe your understanding of the thread pool

  • Thread life cycle (state)

JVM interview questions:

  • Serial garbage collector (single thread, copy algorithm)

  • ParNew garbage collector (Serial+ multithreading)

  • Parallel Scavenge collector (multi-threaded copy algorithm, efficient)

  • Serial Old collector (single-threaded markup algorithm)

  • Parallel Old Collector (Multithreaded Marking Algorithm)

  • CMS collector (multithreaded mark-sweep algorithm)

  • G1 collector

  • JVM class loading mechanism

  • class loader

  • parent delegation

  • OSGI (Dynamic Modeling System)

  • Dynamically change the structure

  • Modular programming and hot swap

  • JVM memory model

  • native method stack

  • program counter

  • heap

  • method area

  • Generational recycling

  • The difference between heap and stack

  • When will FullGC be triggered

  • What is the Java Virtual Machine? Why is Java called a "platform-independent programming language"?

  • Object Assignment Rules

  • Describe the principle mechanism of JM loading class files?

  • Java object creation process

IO vs NIO in Java Interview Questions:

  • 10 streams in Java?

  • Differences between Java 10 and NIO

  • What are the commonly used io classes

  • The difference between byte stream and character stream

  • Block 10 model

  • Non-blocking 10 model

  • Multiplexing 10 models

  • Signal Driven 10 Models

  • Asynchronous 10 Model

  • JAVA NIO

  • NIO's buffer

  • NIO's non-blocking

  • Channel

  • Buffer

Mysql interview questions:

  • How to deal with the d primary key after sub-database sub-table

  • Stored procedures (sets of SQL statements for specific functions)

  • Stored procedure optimization ideas

  • Trigger (a program that can be executed automatically)

  • database concurrency strategy

  • What kinds of locks are there in MySQL?

  • What are the different tables in MySQL?

  • Briefly describe the difference between MyISAM and InnoDB in the MySQL database

  • What are the names of the four transaction isolation levels supported by InnoDB in MySQL, and the differences between them step by step?

  • What is the difference between CHAR and VARCHAR?

  • What is the difference between primary key and candidate key?

  • What is myisamchk used for?

  • What is the difference between MyISAM Static and MyISAM Dynamic?

  • What happens if a table has a column defined as TIMESTAMP?

  • How do you see all the indexes defined for the table?

  • What do the % and _ in the LIKE statement mean?

  • What is the column comparison operator?

  • What is the difference between BLOB and TEXT?

  • What is the difference between MySQL fetch.array and MySQL fetch object?

  • Where will MyISAM tables be stored, and also in what format are they stored?

  • How does MySQL optimize DISTINCT?

  • How to display top 50?

  • How many columns can be used to create an index?

  • What is the difference between NOW () and CURRENT_DATE ()?

  • What is a non-standard string type?

  • What are generic SQL functions?

  • Does MySQL support transactions?

Redis interview questions:

  • Is Redis single-process and single-threaded?

  • What is the maximum capacity of a smart storage of type string?

  • Redis persistence mechanism

  • Cache avalanche, cache penetration, cache warm-up, cache update, cache downgrade, etc.

  • What are hot data and cold data

  • Why is single-threaded redis so fast

  • The data types of redis and the usage scenarios of each data type

  • Redis expiration strategy and memory elimination mechanism

  • Redis common performance problems and solutions?

  • Why are Redis operations atomic, and how to ensure atomicity?

  • Redis transactions

  • What is the persistence mechanism of Redis? Their respective advantages and disadvantages?

  • Redis common performance problems and solutions:

  • Redis expired key deletion strategy?

  • Redis recycling strategy (sea elimination strategy) ?

  • Why does edis need to put all data in memory?

  • Do you understand the synchronization mechanism of Redis?

  • What are the benefits of Pipeline, why use pipeline?

  • Have you ever used a Redis cluster? What is the principle of the cluster?

  • Under what circumstances will the Redis cluster solution cause the entire cluster to be unavailable?

  • What are the Java clients supported by Redis? Which one is officially recommended?

  • What are the advantages and disadvantages of Jedis and Redisson?

  • How does Redis set password and verify password?

MongoDB interview questions:

  • What happens when updating a document on a Chunk that is being migrated?

  • MongoDB builds an index on A:(B,C}, will queries A:{B,C] and A:{C,B) both use the index?

  • What happens if a query is initiated when a shard is stopped or slow?

  • Does MongoDB support stored procedures? If so, how to use them?

  • How to understand the GridFS mechanism in MongoDB, why does MongoDB use GridFS to store files?

  • What is a NoSQL database? What is the difference between NoSQL and RDBMS? In what situations are NoSQL databases used and not used?

  • Does MongoDB support stored procedures? If so, how to use them?

  • How to understand the GridFS mechanism in MongoDB, why does MongoDB use GridFS to store files?

  • Why are MongoDB data files so large?

  • What happens when updating a document on a Chunk that is being migrated?

  • MongoDB builds an index on A:(B,C}, will queries A:{B,C] and A:{C,B) both use the index?

  • What happens when a shard is stopped or slow

  • What is the role of analyzers in MongoDB?

  • If a user removes an attribute on an object, is that attribute removed from the storage layer?

  • Can the log feature be used for secure backups?

  • Update operations immediately fsync to disk?

  • How to perform transactions/locks?

  • What is master or primary?

  • The role of getLasterror

  • How do sharding and replication work?

  • When will data be expanded to multiple shards?

  • What happens when I try to update a document on a chunk that is being migrated?

MyBatis interview questions:

  • Usually an Xml mapping file will write a Dao interface corresponding to it, please,

  • What is the working principle of this Dao interface? Can the methods in the Dao interface be overloaded when the parameters are different?

  • How to get the auto-generated (primary) key value?

  • How to pass multiple parameters in mapper?

  • What is the use of Mybatis dynamic sql? Execution principle? What kind of dynamic sql are there?

  • In the Xml mapping file, besides the common selectlinsertlupdaeldelete tag, what other tags are there?

  • In the Xml mapping file of Mybatis, can the id of different Xml mapping files be repeated?

  • Why is Mybatis a semi-automatic ORM mapping tool? What is the difference between it and fully automatic?

  • One-to-one, one-to-many relational queries?

  • How many ways does MyBatis implement one-to-one? How does it work?

  • MyBatis implementation - there are several ways to many, how to operate?

  • Does Mybatis support lazy loading? If so, what is its implementation principle?

  • Mybatis's first and second level cache

  • What is MyBatis interface binding? What are the implementation methods?

  • What are the requirements when using the mapper interface call of MyBatis?

  • What are the ways to write Mapper?

  • Briefly describe the operating principle of Mybatis plug-ins and how to write a plug-in.

  • How many ways does MyBatis implement one-to-one? How does it work?

Spring interview questions:

  • What is the difference between Spring AOP and AspectU AOP?

  • How to understand the proxy in Spring?

  • What is Weaving?

  • What is the use of Spring MVC framework?

  • Describe the workflow of DispatcherServlet

  • Introduce WebApplicationContext

  • What is spring?

  • What are the benefits of using the Spring framework?

  • What modules does Spring consist of?

  • Spring's IOC and AOP mechanism

  • The difference between Autowired and Resource keywords in Spring

  • There are several ways of dependency injection, what are they?

  • Tell me what is Spring

  • Spring MVC process

  • What is spring MVC

  • How does SpringMVC set redirection and forwarding?

  • What are the annotations commonly used in SpringMVC

  • Spring's AOP understanding

  • Spring's IOC understanding

  • Explain the life cycle of spring beans

  • Explain the scope of several beans supported by Spring.

  • Several ways for Spring to inject beans based on xml

  • What design patterns are used in the Spring framework

  • Core Container (Application Context) Module

  • BeanFactory - Example BeanFactory implementation.

  • XML BeanFactory

  • Explain the AOP module

Spring Boot interview questions:

  • Can we use jetty instead of tomcat in spring-boot-starter-web?

  • How to generate a WAR file using Spring Boot?

  • How to deploy to different servers using Spring Boot?

  • What is the difference between RequestMapping and GetMapping?

  • Why do we not recommend using Spring Data Rest in real applications?

  • In Spring Initializer, how to change the package name of a project?

  • Where can I find the complete list of properties that can be configured in application.propertier?

  • What is the difference between JPA and Hibernate?

  • What dependencies are required to start a JPA application connected to an in-memory database H2 using Spring Boot?

  • How to choose Hibernate as the default implementation of JPA without any configuration?

  • Where is the specified database connection information? How does it know to automatically connect to H2?

  • How do we connect to an external database like MSSQL or orcale?

  • The name of the default H2 database configured by Spring Boot is above? Why is the default database name testdb?

  • If H2 is not in the class path, will the above situation occur?

  • Can you give an example with ReadOnly as transaction management?

  • What's the best way to publish Spring Boot user application custom configuration?

  • What are the requirements for configuration files?

  • How to use the configuration file to configure the configuration of a specific environment through Spring Boot?

  • How can we set up a Spring Boot application using Maven?

  • How to disable a specific autoconfiguration?

  • What external configuration does Spring boot support?

  • How to test Spring Boot application?

  • What is the use of Spring Boot Actuator?

  • Where can the default location of the static homepage in SpringBoot be placed?

  • What is the priority of static resource direct mapping in SpringBoot?

Spring Cloud interview questions:

  • What is the difference between SpringBoot and SpringCloud?

  • What is a Hystrix circuit breaker? Do we need it

  • Talk about the realization principle of RPC

  • Advantages and disadvantages of microservices? Tell me about the pits encountered in the development project?

  • What is the difference between spring cloud and dubbo?

  • Comparing REST and RPC

  • Do you know the microservice technology stack?

  • How do microservices communicate independently?

  • How does springcloud implement service registration?

  • The difference between Eureka and Zookeeper

  • What is eureka's self-protection mechanism?

  • What is Ribbon?

  • What is feigin? What are its advantages?

  • What is the difference between Ribbon and Feign?

  • What is Spring Cloud Bus?

  • Springcloud circuit breaker role?

  • Spring Cloud Gateway?

  • As a service registry, how is Eureka better than Zookeeper?

  • What is Ribbon load balancing?

  • What can Ribbon load balancing do?

  • What is zuu|routing gateway

  • What can the distributed configuration center do?

Data structure interview questions:

  • stack

  • queue

  • Linked list (Link)

  • Hash Table

  • sort binary tree

  • Front tassel tree

  • red black tree

  • B-TREE

  • bitmap

Algorithm interview questions:

  • There are {1,2,3,4,5,6,7,8,9} in the data. Please randomly shuffle the order and generate a new array (please implement it with code)

  • Write the code to judge whether an integer is a power of 2 (please implement the code, please do not call the API method)

  • Assuming today is March 1, 2015, Sunday, please calculate the day of the week after 13 months and 6 days, and the number of days from now (please use code to implement, please do not call API methods)

  • There are two baskets, namely A and B. Basket A contains eggs, and basket B contains apples. Please use object-oriented thinking to realize the exchange of items in the two baskets (please use code to implement)

  • binary search

  • Bubble Sort Algorithm

  • insertion sort algorithm

  • quick sort algorithm

  • Hill sort algorithm

  • Merge Sort Algorithm

  • bucket sort algorithm

  • Radix sorting algorithm

  • pruning algorithm

  • backtracking algorithm

  • shortest path algorithm

  • Minimum Spanning Tree Algorithm

  • AES

  • RSA

  • CRC

  • MD5

  • More algorithm exercises

Kafka interview questions:

  • Consumer Group

  • How to get a list of topic topics

  • What is the command line for the producer and consumer?

  • Is the consumer push or pull?

  • Talk about kafka's method of maintaining consumption status tracking

  • Talk about master-slave synchronization

  • Why do you need a message system, can mysql not meet the demand?

  • What is the role of Zookeeper for Kafka?

  • What are the two conditions for Kafka to judge whether a node is still alive?

  • There are three key differences between Kafka and traditional MQ messaging systems

  • Talk about the three mechanisms of Kafka's ack|

  • How can the consumer not automatically submit the offset, but submit it by the application?

  • Consumer failure, how to solve the problem of overlock?

  • How to control the location of consumption

Microservices interview questions:

  • What is the purpose of Container in microservices?

  • What is DRY in microservice architecture?

  • What is a Consumer Driven Contract (CDC)?

  • What is the role of Web, RESTful API in Microservices?

  • What do you know about semantic monitoring in microservices architecture?

  • How do we do cross-functional testing?

  • How can we eliminate indeterminism in testing?

  • What is the difference between Mock or Stub?

  • How much do you know about Mike Cohn's testing pyramid?

  • What is the purpose of Docker?

  • What is a canary release?

  • What is Continuous Integration (CI)?

  • What is Continuous Monitoring?

  • What is the role of the architect in microservice architecture?

  • Can we create state machines with microservices?

  • What is Reactive Scaling in Microservices?

Elasticsearch interview questions

  • What are the optimization methods for Linux settings when Elasticsearch is deployed

  • What is the internal structure of ucence?

  • How does Elasticsearch realize the Master election?

  • Nodes in Elasticsearch (for example, a total of 20), 10 of which are selected

  • One master, another 10 choose another master, what should I do?

  • When the client connects to the cluster, how does it select a specific node to execute the request?

  • Describe in detail the process of Elasticsearch indexing documents.

  • Describe in detail the process of updating and deleting documents in Elasticsearch.

  • Describe the process of Elasticsearch search in detail

  • In Elasticsearch, how to find the corresponding inverted index according to a word

  • When Elasticsearch is deployed, what are the optimization methods for Linux settings?

  • Regarding GC, what should be paid attention to when using Elasticsearch?

  • How does Elasticsearch implement the aggregation of large data volumes (hundreds of millions)?

  • How does Elasticsearch ensure read and write consistency under concurrency?

  • How to monitor Elasticsearch cluster status?

  • Introduce the overall technical architecture of your e-commerce search

  • Tell us about your personalized search solution?

  • Do you know about dictionary trees?

  • How is spelling error correction implemented?

Summarize

Whether it is a technical manager or an architect, there is no absolute way to say which path is right or wrong, and the most important thing is to suit yourself. Small companies may not have the concept of an architect, and the position of an architect in a large company is not so easy to win. But in any case, it is necessary to constantly learn new technologies and improve your own level. No matter which company you are in, you can only enjoy yourself with a strong technical level.

Guess you like

Origin blog.csdn.net/qq13321123/article/details/132078308