A collection of BAT's JAVA interview questions in early 2017

A large number of O2O companies have been born under the wave of Internet+. In 2016, live broadcasts became popular, and AI became popular. Whether it is products or technologies, the Internet industry is no less lively than the trend of fashion circles. In the second year of the winter of Internet capital, some people hibernate and others swim in the winter. However, the competition in the IT technology industry is becoming more and more brutal, and a large number of training institutions have risen to train talents in large quantities, resulting in an oversupply of supply. Of course, this does not mean that the market is saturated, but the market selection tends to be more reasonable. Some Eastern Time students went to Ali for an interview and sorted out the interview questions about JAVA by the way. I hope it will be helpful to you, and will continue to update and add new interview questions in the future. It can help you find out what is missing. The following is a collection of some interview questions of BAT in 2016 and early 2017. Only some of the interview questions have answers. Don't memorize them by memorization.

Java Basics

● Collection class and collection framework; HashMap and HashTable implementation principle, thread safety, hash conflict and processing algorithm; ConcurrentHashMap;

● The difference between process and thread;

● Java's concurrency, multithreading, threading model;

● What is a thread pool and how to use it? Answer: A thread pool is to put multiple thread objects into a container in advance. When using it, you don't need to use new threads, but go directly to the pool to get threads.

● How to ensure data consistency; Synchronized keyword, class lock, method lock, reentrant lock;

● What is the mechanism for implementing polymorphism in Java;

● How to serialize a Java object into a file;

● Talk about your understanding of Java reflection; A: The reflection in Java is first to obtain the bytecode of the class to be reflected in Java. There are three ways to obtain the bytecode.

● Synchronization method; multi-process development and multi-process application scenarios;

● The difference between wait and seek methods in Java; A: The biggest difference is that wait will release the lock while waiting, while sleep always holds the lock. wait is usually used for inter-thread interaction, and sleep is usually used to suspend execution.

● The role of synchronized and volatile keywords; Answer: 1) It ensures the visibility when different threads operate on this variable, that is, a thread modifies the value of a variable, and the new value is immediately visible to other threads . 2) Instruction reordering is prohibited.

● The essence of volatile is to tell the jvm that the value of the current variable in the register (working memory) is uncertain and needs to be read from the main memory; synchronized is to lock the current variable, only the current thread can access the variable, and other threads are blocked live.

1.volatile can only be used at the variable level; synchronized can be used at the variable, method, and class level

2. volatile can only achieve the modification visibility of variables, and cannot guarantee atomicity; synchronized can guarantee the modification visibility and atomicity of variables

3.volatile will not cause thread blocking; synchronized may cause thread blocking.

4. Variables marked with volatile will not be optimized by the compiler; variables marked with synchronized can be optimized by the compiler

● The server only provides data receiving interface, how to ensure the orderly arrival of data under the condition of multi-thread or multi-process;

● ThreadLocal principle, implementation and how to ensure the Local attribute;

● String StringBuilder StringBuffer对比;

● What are the design patterns you know? Answer: There are generally 23 design patterns in Java, we don't need to know all of them, but some of the commonly used design patterns should be mastered. All design patterns are listed below. I have listed the design patterns that need to be mastered separately. Of course, the more I can master, the better.

Generally speaking, design patterns are divided into three categories:

There are five types of creational patterns: factory method pattern, abstract factory pattern, singleton pattern, builder pattern, and prototype pattern.

There are seven structural patterns: adapter pattern, decorator pattern, proxy pattern, appearance pattern, bridge pattern, composition pattern, and flyweight pattern.

There are eleven behavioral patterns: strategy pattern, template method pattern, observer pattern, iteration sub pattern, responsibility chain pattern, command pattern, memorandum pattern, state pattern, visitor pattern, mediator pattern, and interpreter pattern.

● How Java calls c and c++ languages;

● Interface and callback; the principle of callback; write a callback demo;

● Generics principle, with examples; parsing and dispatching;

● Differences between abstract classes and interfaces; application scenarios; whether abstract classes can have no methods and attributes;

● Can static properties and static methods be inherited? Can it be rewritten? and why?

● Modify the signature of the equals method of object A, then when using HashMap to store this object instance, which equals method will be called;

● Talk about your understanding of generics;

● Java's exception system;

● How to control the number of concurrent access threads allowed by a method;

● The difference between dynamic proxies and what scenarios to use;

latest part

● Briefly describe synchronized?Object; Monitor mechanism;

● Briefly describe the happen-before rule;

● JUC and Object; What is the difference between Monitor mechanism; Briefly describe the principle of AQS;

● Briefly describe the reasons for DCL failure and the solutions;

● Briefly describe the principle of nio;

● What are the components of the jvm runtime data area, and their respective functions;

● What are the gc algorithms; what are the gc collectors;

● Briefly describe the process of each stage of class loading; class; what models does the loader have;

● Briefly describe the commonly used JDK command line tools;

● Briefly describe the composition of bytecode files;

● Talk about how you usually optimize for specific SQL;

● What are the storage engines of mysql, and the differences;

● gc: memory model;

● gc: garbage collection;

● Multithreading: How to implement a tool class for timing scheduling and circular scheduling. However, when the submitted task cannot be processed, how should the rejection mechanism be handled? What kinds of rejection mechanisms are there by default in the thread pool?

● Multithreading: How to implement a ThreadLocal;

● Talk about a thread-safe queue you know about;

● What is the implementation principle of the Atomic package;

● How does CAS ensure atomicity;

● How much memory is used by subString for string analysis 1000 loops;

Data Structures and Algorithms

● What is the difference between heap and stack in memory (in terms of data structure and actual implementation);

● What is the fastest sorting algorithm? Which algorithm should I choose to sort Alibaba's more than 20,000 employees by age? The difference between heap and tree; write quick sort code; linked list reverse order code;

● Find the number of daffodils within 1000 and the number of daffodils within 4 billion;

● Substring inclusion problem (KMP algorithm) write code to realize;

● Two URL files A and B at the trillion level, how to find the difference C of A and B, (Bit mapping -> hash grouping -> multi-file read and write efficiency -> disk addressing and application-level addressing optimization)

● Ant colony algorithm and Monte Carlo algorithm;

● Write down the time-space complexity and stability of the sorting algorithm you know;

● How to try to find the nearest business function in Baidu POI (coordinate mirror + R tree).

other

● Four necessary conditions for deadlock;

● Common encoding method; Chinese in utf-8 encoding occupies several bytes; int type several bytes;

● Implement a Json parser (the speed can be improved by regularization);

● MVC MVP MVVM; common design patterns; write code for the observer pattern;

● 3-way handshake and 4-way wave of TCP; the difference between TCP and UDP;

● HTTP protocol; difference between HTTP1.0 and 2.0; HTTP message structure;

● The difference between HTTP and HTTPS and how to achieve security;

● Which frameworks and platforms have been used;

● Which custom controls have been used;

● Introduce what projects you have done;

non-technical issues

● What are the more in-depth research areas;

● What are the channels for paying attention to industry information;

● What books have you read recently;

● The technical point that you are best at, the technical field and technical point that you are most interested in;

● Which open source libraries are used in the project, and how to avoid security and stability problems caused by the introduction of open source libraries;

● What did you do and what was the output during the internship;

● 5 coins, how to divide 2 heads and 3 tails into two piles and then flip the two piles so that the number of coins on heads and tails in the two piles are the same;

● The hour hand makes a circle, and the hour and minute hands overlap several times;

● N * N graph paper, how many squares are in it;

● Now the download speed is very slow, try to analyze the reason from the perspective of network protocol, and optimize it (5 layers of the network can be involved).

HR questions

● What was the reason for your departure from the previous company?

● Talk about one thing that impressed you the most;

● Introduce a project that you have had the most influence on;

● Introduce your favorite professional field;

● What is the biggest gain of the company's internship;

● What will you do when you disagree with your superiors;

● What are your strengths and weaknesses? and give an example?

● What is your learning method like? How did you learn during the internship? What are the biggest difficulties encountered in the internship program and how to solve them;

● Say one thing that best proves your ability;

● What do you think you still lack for the position you are applying for;

● What should you do if we hired you through this interview, but found that you are not suitable for this position after working for a period of time;

● What is the biggest difficulty encountered in the project? how to solve it;

● Your career plan and personal goals; future development route and job search orientation;

● If you are not hired in this interview, what are your plans;

● Evaluate yourself, evaluate your technical level, and how much your personal code is;

● Through which channels did you learn about the recruitment information, and which companies did other students invest in?

● What hobbies do you have in your spare time?

● What has you done that you are most proud of?

● If you are going to send a classmate who is going abroad to the airport at night, but the unit has something to do temporarily, what should you do?

● What do you think you are lacking for the position you are applying for;

● Current offer status; how to choose if BATH has given an offer;

● What do you value more about a job? platform, technology, atmosphere, city, money;

● Ideal salary range; which one to choose between Hangzhou Post and Beijing Post;

● What is the ideal working environment;

● Talk about your views on job-hopping;

● Tell us your opinion on the development trend of the industry and technology;

● What are the things worth learning about the colleagues/classmates around you during the internship;

● Your family's work expectations and your own work expectations;

● What do you think should be done if you make mistakes in your work and cause economic losses to the company;

● What to do if your boss misunderstands you in a public meeting;

● Is it possible to practice and how long can it be practiced;

● your career plan over a five-year period;

● What do you like about the company? Or those aspects of the company that appeal to you the most.


Address of this article: http://liuyanzhao.com/3295.html

Reprint please indicate

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325279322&siteId=291194637