What should I do if I can't find a job as an Android programmer? What if the interview always fails?

What if the programmer can't find a job? What if I always fail the interview? Let's talk about the common questions in the interview.

CV

If you submit your resume every day, you will not get an interview opportunity. In fact, this problem is very simple, because your resume is not well written. Think about it, HR has never met anyone who knows you, and can only see you. The content of your resume, if you can't get an interview opportunity, then find a way to optimize your resume.

For example, the technical points you are good at, project experience, achievements, etc., if you really can’t get an interview opportunity, you can exaggerate a little bit, which is the so-called beautifying your resume, the purpose is to get an interview opportunity. Only when you get an interview opportunity, you have the opportunity to show yourself and let the interviewer understand you, right?

Self introduction

When you get an interview opportunity, the interviewer's first question is often, you can introduce yourself first.

Don't just say it casually. This question is very important. This self-introduction is your first impression on the interviewer. Think about it, when you go on a blind date, does the first impression matter? An interview is similar to a blind date, and first impressions are very important.

Before going to the interview, you must prepare the content of self-introduction in advance, and practice it a few times. Don’t let you think about it when you say it, it will give people a completely different feeling. You can guarantee that every sentence Are the words very fluent? Can you promise to name all your highlights? Therefore, it is very natural to say that you have to prepare in advance.

How about self-introduction?

Generally, it should not exceed 1 minute. The interviewer does not have so much time to listen to your detailed personal experience, so you must talk about the key points within one minute. For example, what is my name, what position do I want to apply for, how many years of relevant work experience I have, roughly what projects I have done, and what are the results of the project? According to my past project experience and our company’s requirements for this position, I feel that I am more suitable for this position and so on.

Reason for leaving

Another sensitive topic, but basically most interviewers will ask, why did you leave your previous company?

You must not say like some straightforward programmers, I was laid off, or that our department had a large number of layoffs, and I was laid off. If you answer this way, it will give the interviewer the feeling that your skills are not good enough and you have been eliminated.

Don’t say it’s because the previous company’s wages are too low, don’t say that you work too much overtime, let alone how your boss is, in short, don’t say anything bad about the previous company. As long as you say that the previous company was not good, it will give people the impression that you have too many things to do and are not stable. Even if you are hired, you will not work in the company for long and leave.

You can say, I want to continue to cultivate in this major, but the previous company is adjusting the business direction, which is not very consistent with my career development plan, so I left. If you put it that way, it will give people a completely different feeling, you can experience it.

technical interview questions

I would like to give you some suggestions, search for some interview questions on the Internet in advance, and look at the interview question bank.

Think about it, the interviewer is also an ordinary person. Don’t think too much about him. He may not be better than you technically. Therefore, it is generally difficult for the interviewer to create questions, and most of the questions are common. If there is a new question, it is also based on the project in your resume. For example, he will ask, what functions did you do in this project, how did you realize this function, and what technical points were used. In this way, the interviewer will dig deep into this technical point. On the one hand, it is to judge whether this project is really done by you, and on the other hand, it is to examine your technical level. If you can speak out the few questions I just mentioned fluently, basically there is no problem in terms of project experience.

Of course, there will also be some weird interviewers, who will leave their resumes to ask some technical points he wants to ask, or the technical difficulties he has encountered recently, ask about your problem-solving ideas, and so on. There is no good way to do this kind of thing. It mainly depends on your technical accumulation and the interview question bank you memorized. This kind of question may not be able to answer all the questions. Most of them can be said. Of course, the more comprehensive the better, it is best to ask the interviewer after answering. My answer may not be comprehensive. , do you have a better solution. Or, I generally use this technique to solve this problem, how do you generally solve it. How to put it, during the interview process, communicate with the interviewer more, so that the interviewer can get to know you while also getting to know the interviewer. Don't sit there motionless, answer whatever the interviewer asks you, and don't talk unless you ask, try to make the interview process as easy as possible.

at last

For those who don’t have interview materials or don’t know where to find more comprehensive interview materials, you can refer to this "Summary of Android Interview Questions " I compiled, which includes Java basics, Java multithreading, virtual machines, Android, and algorithms. , Kotlin, Flutter, Android Framework, audio and video, common enterprise interview questions , each section has detailed answers to each interview question.

Interview question display

* 1. What is the difference between an abstract class and an interface?

1. Abstract classes can provide the implementation details of member methods, but only public abstract methods can exist in interfaces;
2. Member variables in abstract classes can be of various types, while member variables in interfaces can only be public static final types 3.
Interfaces cannot contain constructors, static code blocks, and static methods, while abstract classes can have constructors, static code blocks, and static methods; 4. A class can only inherit one
abstract class, but a class can implement Multiple interfaces;
5. The access speed of abstract classes is faster than that of interfaces, because interfaces take time to find the methods implemented in the class;
6. If you add new methods to abstract classes, you can provide it with default accomplish. Therefore you don't need to change your current code.
7. If you add methods to an interface, then you must change the class that implements the interface.
8. Interfaces are more used to constrain the behavior of classes and can be used for decoupling, while abstract classes focus more on code reuse.

2. How does the caller obtain the method of the bound Service

The onBind callback method will return an instance of the IBinder interface to the client. IBinder allows the client to call back the method of the service, such as getting the running status of the Service or other operations. We need the IBinder object to return a specific Service object to operate, so the specific Service object must first implement the Binder object.

3. The case of using both startService and bindService

If a Service is started and bound again, the Service will always run in the background. First of all, no matter how it is called, onCreate will always be called only once. Corresponding to how many times startService is called,
how many times the Service's onStart method will be called. The termination of Service needs to call unbindService and stopService at the same time. Regardless of the calling order of startService and bindService, if you call unbindService first, the service will not terminate automatically at this time, and then stopService will be called before the service will terminate; if stopService is called first, the service will not be terminated at this time, and call unbindService or
before The service will stop automatically after the Context that calls bindService no longer exists (such as when the Activity is finished).

So, under what circumstances do you use both startService and bindService?

If you just want to start a background service for a long-term task, then use startService. If you still want to get in touch with the running Service, there are two ways: one is to use broadcast, and the other is to use bindService. The disadvantage of the former is that if the communication is more frequent, it is easy to cause performance problems, while the latter does not have these problems. Therefore, in this case, startService and bindService need to be used together.

In addition, if your service only exposes a remote interface for the connected client (Android Service is a C/S architecture) to remotely call the execution method, at this time you can not let the service run at the beginning, but just bindService, so that Only when you bindService for the first time will you create an instance of the service to run it, which will save a lot of system resources, especially if your service is a remote service, then the effect will be more obvious (of course, it will take a certain amount of time to create it in Servcie time, this needs attention).

4. What is the reflection mechanism? What are the application scenarios of the reflection mechanism?

The Java reflection mechanism is in the running state. For any class, you can know all the properties and methods in this class, and for any object, you can call any of its methods and properties; this dynamically obtained information and dynamic The ability to call methods of an object is called the reflection mechanism of the Java language.
Application scenarios: 1. Reverse code, such as decompilation
2. Frameworks combined with annotations, such as Retrofit
3. Pure reflection mechanism application frameworks, such as EventBus (event bus)
4. Dynamically generated class frameworks such as Gson

5. Talk about your understanding of type erasure in Java generics, and talk about its limitations?

Generics in Java are basically implemented at the compiler level. The type information in generics is not included in the generated Java bytecode. The type parameters added when using generics will be removed when the compiler compiles. This process is called type erasure. Limitations: Types such as List and List defined in the code will become List after compilation. What the JVM sees is just the List, and the type information attached by the generic is invisible to the JVM. The Java compiler will try to find possible errors during compilation, but it still cannot avoid the occurrence of type conversion exceptions at runtime. Type erasure is also an important difference between Java's approach to generics and the way C++'s template mechanism is implemented.

Sixth, can you specifically talk about how the deadlock is caused?

In the POSIX standard, the behavior of fork is this: copy the data of the entire user space (usually using the copy-on-write strategy, so it can be achieved very quickly) and all system objects, and then copy only the current thread to the child process . Here: All other threads in the parent process evaporate suddenly in the child process. For locks, from the perspective of the OS, each lock has an owner, that is, the thread that locked it last time. Assuming such an environment, before fork, a child thread locks a certain lock and obtains ownership of the lock. After fork, all extra threads evaporate in the child process. However, the lock is copied normally. From the perspective of the child process, the lock has no owner, so no one can unlock it. When the child process wants to lock the lock, there is no longer any way to unlock it. program deadlock

7. Do you understand the memory mapping principle of MMAP?

The implementation process of MMAP memory mapping can be generally divided into three stages:
(1) The process starts the mapping process and creates a virtual mapping area for mapping in the virtual address space

  1. The process calls the library function mmap in user space, prototype: void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
  2. In the virtual address space of the current process, find a free continuous virtual address that meets the requirements
  3. Allocate a vm_area_struct structure for this virtual area, and then initialize each field of this structure
  4. Insert the newly created virtual area structure (vm_area_struct) into the process's virtual address area list or tree

(2) Call the system call function mmap of the kernel space (different from the user space function) to realize the one-to-one mapping relationship between the physical address of the file and the virtual address of the process

  1. After allocating a new virtual address area for mapping, find the corresponding file descriptor in the file descriptor table through the file pointer to be mapped, and link to the file of the file in the kernel "open file set" through the file descriptor Structure (struct file), each
    file structure maintains various information related to the opened file.
  2. Link to the file_operations module through the file structure of the file, and call the kernel function mmap, whose prototype is: int mmap(struct file *filp, struct vm_area_struct *vma), which is different from the user space library function.
  3. The kernel mmap function locates the physical address of the file disk through the virtual file system inode module.
  4. The page table is established through the remap_pfn_range function, which realizes the mapping relationship between the file address and the virtual address area. At this time, this piece of virtual address does not have any data associated with main memory. Note: The first two stages are only to create a virtual area and complete address mapping, but do not copy any file data to main memory.
    A real file read is when a process initiates a read or write operation. The read or write operation of the process accesses the mapped address of the virtual address space. By querying the page table, it is found that this address is not on the physical
    page. Because only the address mapping has been established at present, the real hard disk data has not been copied into the memory, so a page fault exception is caused.


(3) The process initiates access to this mapping space, causing a page fault exception , and realizing the copy of the file content to the physical memory (main memory) Copy of any file data to main memory. A real file read is when a process initiates a read or write operation. The read or write operation of the process accesses the mapped address of the virtual address space. By querying the page table, it is found that this address is not on the physical page. Because only the address mapping has been established at present, the real hard disk data has not been copied into the memory, so a page fault exception is caused.

  1. A series of judgments are made for page fault exceptions. After confirming that there is no illegal operation, the kernel initiates a request paging process.
  2. The paging process first looks for the memory page that needs to be accessed in the swap cache space (swap cache). If there is no page, the nopage function is called to load the missing page from the disk into the main memory.
  3. After that, the process can read or write to this piece of main memory. If the write operation changes its content, the system will automatically write back the dirty page to the corresponding disk address after a certain period of time, that is, the process of writing to the file is completed.

Note: The modified dirty pages will not be updated back to the file immediately, but there will be a delay for a period of time, you can call msync() to force synchronization, so that the written content can be saved to the file immediately

8. Briefly describe the overall principle of the Handler mechanism

  1. Looper prepares and starts the round robin: Looper#prepare() initializes the thread-specific Looper and MessageQueue Looper#loop() starts an infinite loop to read the next Message in the MessageQueue that meets the execution time. If there is no Message yet, call pollOnce( on the Native
    side ) enters infinite waiting and if there is a Message, but the execution time when has not been satisfied, the
    remaining time parameter is passed in when pollOnce() is called to enter limited waiting

  2. Message sending, enqueue and dequeue: If the Native side is waiting infinitely: After any thread sends a Message or Runnable to the Handler, the Message will be inserted into the appropriate MessageQueue corresponding to the Looper instance held by the Handler according to the order of when conditions Location.
    MessageQueue will call the wake() on the Native side to wake up the infinitely waiting thread after finding a suitable Message to insert .
    This will prompt the reading of MessageQueue to continue into the next cycle. At this moment , the Message that already meets the conditions in the Queue will be dequeued and returned to the Looper Native side. If it is in a limited wait: epoll_wait
    will return after waiting for a specified period of time. The thread continues to read the MessageQueue. At this moment, because the duration condition will be satisfied, it will be dequeued. Looper processes the implementation of the Message:
  3. After Looper gets the Message, it calls back the callback property of the Message, which is Runnable, or executes the callback of the Handler according to the target property, namely Handler. If the mCallback property exists, call back Handler$Callback; otherwise, call back
    handleMessage()

9. Why should system.server be started in Zygote instead of directly started by init?

As an incubator, Zygote can load some resources in advance, so that other processes created based on the Copy-On-Write mechanism during fork) can directly use these resources without reloading. For example, system.server can directly use JNI functions, shared libraries, commonly used classes, and theme resources in Zygote.

10. How does the Binder mechanism work across processes?

1. Binder driver
1.1 Create in kernel space - block receiving buffer area,
1.2 Realize address mapping: map kernel buffer area, receiving process user space to the same receiving buffer area
2. Sending process transfers data through system call (copy.from_user) sent to the kernel cache. Since there is a mapping relationship between the kernel buffer area and the user space of the receiving process, it is equivalent to sending the user space of the receiving process, realizing cross-process communication.

Due to the limited space of the article, I can't show all the interview questions I have sorted out, but it doesn't matter, I have sorted out all the interview questions

insert image description here

Friends who need complete interview questions and answer analysis can scan the QR code below to get it for free!

Guess you like

Origin blog.csdn.net/weixin_43440181/article/details/132187939