These interview questions are brought back by the owner’s body, and they are absolutely authentic. The owner of the library is also the first line of companies have been on the point of the people, at first because of the first line of companies have very similar questions, later during the day after the interview, at night to sort out the interview questions and answers, slowly formed the Github AndroidInterview-Q-A project, now also 6K Star project. The interview questions come from the internal question banks of Baidu, Xiaomi, LeEco, Meituan, 58, Cheetah, 360, Sina and Sohu. Familiarity with the knowledge listed in this article will greatly increase your chances of passing the first two rounds of technical interviews. Address: http://www.jackywang.tech/AndroidInterview-Q-A/, or click here to read the original, the following for the question.

Java

The Meaning of Interface (Baidu)

Specification, extension, callback

The Meaning of Abstract Classes (LetV)

Provide a common type to encapsulate the abstract methods defined in the repeated content of subclasses, which have different implementations but consistent definitions

The role of internal Classes (Baidu, LeEco)

  1. An inner class can have multiple instances, each of which has its own state information and is independent of the information of other peripheral objects.

  2. Within a single enclosing class, you can have multiple inner classes implement the same interface in different ways, or inherit from the same class.

  3. The time at which the inner class object is created does not depend on the creation of the outer class object.

  4. The inner class does not have a confusing “IS-A” relationship; it is a separate entity.

  5. The inner class provides better encapsulation and is not accessible by any other class except the enclosing class

Can a static method of a parent class be overridden by a subclass? Why? (leopard)

Can’t

Subclass inherits the parent class, use the same method of static and non-static methods, then non-static methods covered in the parent class method (namely rewriting), the static method of the parent is hidden (if the object is the parent class is called the hidden method), the other a subclass inherits the parent class of the static and non-static methods, as for the method overloading I think it is one of the elements in the same class, Can’t say what method in a parent class or what method in a child class is a reflection of method overloading

Give 1-2 sorting algorithms and implement them in Java code (Meituan)

http://blog.csdn.net/qy1387/article/details/7752973

Java VIRTUAL Machine features (Baidu, LeEco)

A very important feature of the Java language is its platform-independence. The use of Java virtual machine is the key to achieve this feature. Normal high-level languages need to be compiled into at least different object code if they are to run on different platforms. With the introduction of the Java language VIRTUAL machine, the Java language does not need to be recompiled when running on different platforms. The Java Language Usage Pattern The Java Virtual machine shields platform-specific information, allowing Java language compilers to run on multiple platforms without modification, simply by generating object code (bytecode) that runs on the Java Virtual machine. When the Java virtual machine executes bytecodes, it interprets the bytecodes as machine instructions on a specific platform.

Android

What are the operation types of the database and how to import the external database?

Include the original database in the project source code in RES/RAW

Under Android system, the database should be stored in /data/data/com.*.* (package name)/directory, so what we need to do is to pass the existing database into that directory. To do this, use FileInputStream to read from the original database, and use FileOutputStream to write the read to that directory.

Have you used local broadcast? What is the difference between global broadcast and local broadcast?

Because broadcast data is spread within the scope of this application, there is no need to worry about privacy data leakage. There is no need to worry about other applications forgery broadcast, causing security risks. It is more efficient than sending a global broadcast within the system.

Have you used intentServer, what does it do, and what problems does AIDL solve? (millet)

Generate a default worker thread independent of the main thread to execute all Intetnt passed to the onStartCommand() method.

Create a work queue to deliver Intent objects to your onHandleIntent() method, one at a time, so you don’t have to worry about multithreading. The service is stopped automatically after all intents have been executed, so you don’t need to call the stopSelf() method to stop.

The service provides a default implementation of the onBind() method, which returns NULL.

Provides a default implementation of the onStartCommand() method, which delivers an Intent to a work queue and then fetches it one at a time from the work queue to the onHandleIntent() method, where the Intent is handled accordingly.

AIDL (Android Interface Definition Language) is an IDL Language. Code that generates interprocess communication (IPC) between two processes on an Android device. AIDL can be used to generate serializable parameters if you want to invoke an operation on an object in one process (such as an Activity) in another process (such as a Service). The AIDL IPC mechanism is interface oriented, like COM or Corba, but more lightweight. It uses proxy classes to pass data between the client and the implementation.

project

tencent

20 million integers. Find the fifth and tenth digits?

Bubble, select, build heap

Load a 10M image from the network

Image caching, abnormal recovery, quality compression

Custom View precautions

Render frame rate, memory

Design patterns commonly used in projects

Singleton, observer, adapter, builder.

The understanding of the JVM

http://www.infoq.com/cn/articles/java-memory-model-1

Ali interview questions

Interprocess communication mode

  1. An Intent is used to communicate between activities, services, or broadcastreceivers. Data can be transmitted through an Intent

  2. AIDL way

  3. Messenger way

  4. Using the ContentProvider

  5. The Socket way

  6. Based on file sharing

What is a coroutine

We know that multiple threads are relatively independent, have their own context, and the switch is controlled by the system; Coroutines are also relatively independent and have their own context, but their switching is controlled by themselves, from the current coroutine to other coroutines.

What about memory leaks

Caused by forgetting to free allocated memory

Program counter, which leads to logical addresses (virtual addresses) and physical addresses and their mappings

A program counter in a virtual machine is a small memory area in the Java runtime data area, but it functions like a regular program counter, pointing to the address where the virtual machine is executing bytecode instructions. Specifically, when the virtual machine executes a method that is not native, the program counter points to the address where the virtual machine is executing bytecode instructions. When the virtual machine executes a method native, the value in the program counter is undefined. In addition, program counters are thread private, that is, each thread has its own program counter.

The difference between arrays and linked lists

Arrays are arrays of contiguous elements in memory. Since each element occupies the same amount of memory, you can quickly access any element in the array by subscript. But if you want to add an element to the array, you need to move a large number of elements, hollow out an element space in memory, and then put the element to be added into it. Similarly, if you want to delete an element, you also need to move a large number of elements to fill in the moved element. If your application needs to access data quickly, with little or no insert and delete elements, you should use arrays.

Linked lists, by contrast, are not sequentially stored in memory, but are linked together by Pointers that exist within the elements. For example, the last element has a pointer to the next element, and so on, until the last element. If you want to access an element in a linked list, you need to start with the first element and work your way to the desired element location. But adding and deleting an element to a linked list data structure is as simple as changing the Pointers in the element. If your application is constantly inserting and deleting elements you need to use linked list data structures.

baidu

Pen test

  1. Bubble sort

  2. Lifecycle and simple usage of the four components

  3. Picture frame cache implementation

  4. Design the network request framework

Question and answer

  1. LruCache Default cache size

  2. The relationship between HttpurlConnection and OKHTTP (HttpurlConnection is based on OKHTTP)

  3. Open source library source code analysis

  4. Design an overall App architecture from 0 (can be answered in combination with the evolution of wechat and Taobao architectures)