Experience of the interview questions, first make the next part of the summary.

preface

I've been interviewing for a week. I've experienced all kinds of interviews, good ones, bad ones, long ones, short ones, large companies and small companies. There are not too many companies that have experienced the written examination, but there are also some. This time, I will first summarize the written examination questions that I have experienced. Some of the written examination questions I haven't recorded are mainly meaningless, because some places still ask about relatively old technologies, so I don't want to answer such questions directly. For example, some companies are still asking about the nine built-in objects of JSP. Few Internet companies use JSP now.

Make a summary in the early stage, and then make a comprehensive summary of interview experience after finding a job. In order to ensure the privacy of the company, I won't write the name of the company. Let's do something instead.

written examination

A fresh Internet company

1、 Single choice questions

1. In the publish subscribe message model, after subscribers subscribe to a topic, all subscribers will be notified when new messages arrive on the topic. Which of the following design patterns is most suitable for this model?

A. adapter B. bridge mode C. state mode D. observer mode

[answer] D. observer mode. You need to know which of these design modes.

2. The common characteristics of stack and queue are

A. insert and delete elements only at endpoints

B. they are all first in and last out

C. all are first in, first out

D. no common ground

[answer] A. It is only allowed to insert and delete elements at the endpoint. This can be understood by understanding these two data structures, and the exclusion method can also be excluded.

3. Which of the following expressions is illegal

  A. List foo = new ArrayList
();

  B. List foo = new ArrayList
();

  C. List foo = new ArrayList
();

  D. List foo = new ArrayList
();

[answer] B. list foo = new ArrayList < integer > (); I didn't notice that the middle two generic types were super. I thought all four options were extends, so I chose C at that time.

4. If the JVM parameters of a java process are configured as follows: - xms1g - xmx2g - xmn500m - XX: maxpermsize = 64M - XX: + useconcmarksweepgc - XX: survivorratio = 3, what is the final allocated size of Eden area?

  A. 64M B. 500M C. 300M D. 100M

[answer] for C. 300m, you need to understand the JVM memory structure, - xms1g means that the heap memory is 1g by default, - xmx2g means that the maximum heap memory is 2G by default, - xmn500m means that the default capacity of the new generation is 500m, - xxmaxpermsize = 64M means that the maximum capacity of the permanent generation is 64M, - XX: + userconcmarksweepgc means that CMS garbage collector is used, - XX: survivorratio = 3 means Eden area and two survivor areas The ratio is 3:1:1, so the size of Eden area is three fifths of 500m and 300m.

5. The following are not network layer protocols:

  A. TCP B. IP C. IPX D. ICMP

[answer] A. TCP... Network programming is my weakest point, so I don't know some basic things. I didn't answer this correctly. I chose d at that time.

2、 Multiple choice questions

6. The access permission of AAA file is rw-r -- R --. Now, to increase the execution permission of all users and the write permission of users in the same group, which of the following commands is correct?

  A. chmod a+x g+w aaa

  B. chmod 764 aaa

  C. chmod 775 aaa

  D. chmod o+x g+w aaa

[answer] AC, in Linux system, drwxrwxrwx -- the first bit represents the file type, the first RWX represents the read / write / execute permission of the owner, the second RWX represents the read / write / execute permission of the same group of users, and the third RWX represents the read / write / execute permission of other users. According to the requirements of the project, the modified file permission should be rwxrwxr-x, i.e. 111111101 = 775.

7. LS - L displays as follows: -rwxrw-r-- 1 AAA BBB 0 March 4 11:21 CCC, which of the following statements is correct?

A. the file is a directory

B. the user in the group of the file owner has the right to modify the file

C. The numerical representation of the file authority is 764

D. the owner of the document is BBB

[answer] BC and CCC are files. The permission number is 764 (-rwxrw-r-- converted to octal). The owner is AAA. The user group is BBB. The file size is 0. The last modification time is 11:21 on March 4

8. Which of the following descriptions about HTTP protocol is correct?

A. post requests are generally used to modify resources on the server. There is no limit on the amount of message data sent, and they are submitted through forms

B. 302 in the HTTP return code indicates permanent redirection, and the URI needs to be updated

C. breakpoint continuation can be realized through 206 return code

  D. http1. 1 realizes persistent connection, pipelined operation and active notification function, compared with http1 0 has a significant performance improvement

[answer] ACD, this network programming is my weakness again. I really don't know the answer. The correct answer was found on the Internet later. At that time, a D option was covered. The books on network programming have been prepared and I will learn this knowledge soon.

9. Which of the following functions cannot appear directly in the where clause?

  A. SUM B. COUNT C. ORDER BY D. GROUP BY

[answer] AB, this is relatively simple. Aggregation functions cannot appear after where.

10. Assuming that the system operates in a single channel mode and adopts the short job first algorithm, and four jobs J1, J2, J3 and J4 arrive at the same time, which of the following cases has an average turnaround time of 10 minutes?

A. execution time: J1: 1 minute J2: 5 minutes J3: 9 minutes J4: 13 minutes

B. execution time: J1: 1 minute J2: 4 minutes J3: 7 minutes J4: 10 minutes

C. execution time: J1: 2 minutes J2: 4 minutes J3: 6 minutes J4: 8 minutes

D. execution time: J1: 3 minutes J2: 6 minutes J3: 9 minutes J4: 12 minutes

[answer] BC, take option a as an example: four jobs are reached at the same time. Since the single channel mode is adopted and short jobs are preferred, J1 does not need to wait and is completed in 1 minute; J2 waits for 1 minute and is completed in 5 minutes; J3 waits for 6 minutes and is completed in 9 minutes; J4 waits for 15 minutes and is completed in 13 minutes. - therefore, the average turnaround time of the four jobs is: (J1 * 4 + J2 * 3 + J3 * 2 + J4) / 4

11. Which of the following events will directly cause the Linux system to switch from user mode to kernel mode?

A. respond to hardware interruptions

B. compiler source code

C. perform system call

D. view the system log

[answer] AC, system calls and hardware interrupts will trigger the switch from user mode to kernel mode. I don't know much about Linux, and this content will be supplemented in the future (marked).

12. Which of the following statements is correct?

A. StringBuilder is thread unsafe

B. Java classes can be declared with abstract and final at the same time

C. in HashMap, use get (key) = = null to determine whether the hasmap contains the key

D. volatile keyword does not guarantee atomicity of variable operation

[answer] AD and StringBuilder are thread unsafe. It's right that Java classes can be modified by abstract and final at the same time. The abstract modified class is to enable subclasses to realize their functions, while the final modified class means that there can be no subclasses. These two keywords contradict each other. Therefore, it should not be possible to modify a class at the same time. There can be null key value pairs in HashMap 。 Therefore, it can not be judged by get (key) = = null. Volatile can ensure the visibility of variables and cannot guarantee the atomicity of variable operations (for example, I + + this operation needs to be transformed into new atomicinteger (I) incrementAndGet())。

13. Which of the following types can be thrown by the throw statement?

  A. Error B. Exception C. Throwable D. Object

[answer] ABC and error can also be thrown, but usually the program is interrupted when an error occurs, and we will not capture it.

14. Which of the following different database types do not belong to the category of relational database?

A. MongoDB B. Postgresql C. Redis D. HBase

[answer] abd, those who have used these databases should be able to distinguish them at once.

3、 Subjective question

15. How to serialize Java

[answer] if you want to serialize an object in Java, the class of the object needs to implement the serializable interface or the externalizable interface. The difference is that there is no need to implement any method to implement the serializable interface, while the externalizable interface must be writeexternal() and readexternal() Two empty methods provide implementation—— After the target class implements the interface, the target class object can be serialized and output through objectoutputstream.

16. What are the differences of exception, error and runtimeException in Java exception handling

[answer] exceptions in Java are divided into error and exception. Error generally refers to errors related to virtual machines, such as system crash, virtual machine error, dynamic link failure, etc., which cannot be handled by the application; Exception refers to exceptions that can be handled by the application itself. It is divided into checked exception and runtimeException - checked exception, also known as compile time exception Exception, the java compiler forces us to catch this exception, otherwise the program cannot be compiled; RuntimeException is a runtime exception. The compiler will not check the runtime exception, and we can not handle it. When such an exception occurs, it is always thrown and taken over by the virtual machine. Of course, runtime exceptions can also be caught.

17. Do wait(), notify() and notifyall() need to be placed in the synchronization method / code block when they are used? Why?

[answer] it needs to be placed in the synchronization method / synchronization code block, because these three methods must be called by the synchronization monitor object. In the synchronization code block, the synchronization monitor object is the object in the parenthesis of synchronized(); in the synchronization method, the synchronization monitor object is the implicit current object this. -- when calling wait() Previously, the current thread has obtained the object lock of the synchronization monitor through synchronized. After calling wait(), the thread enters the blocking state and releases the object lock; After other threads obtain the object lock of the synchronization monitor, they start to execute its synchronization method / code block. If notify() is called in the synchronization method / code block, any thread waiting on the synchronization monitor object will be awakened. After the remaining code is executed, the object lock will be released; The awakened thread attempts to obtain the object lock. After obtaining it, the thread continues to execute downward. Notifyall() is similar to notify(), except that notifyall() wakes up all threads waiting on the synchronization monitor object. These threads will compete for the object lock later. Whoever gets the object lock will continue to execute.

18. Programming: delete the elements in another integer array in an integer array, and keep the order of the original array

The input consists of two lines:

1. The first line is the list of deleted integers (recorded as list a), and each integer is separated by a space. 2. The second line is the list of integers to be deleted (recorded as List B), and each integer is separated by a space

The output has only one line, that is, the integer list after deleting the elements of List B in list a. the output elements are arranged in the order in list a, and each integer is separated by a space

Sample input: 1 2 3 4 5 2 4 sample output: 1 3 5

The answer to this question is not unique. The idea I give is to convert two arrays into two ArrayLists, and then put the equal elements in the first row array and the second row array into a new list through two iterations. Finally, directly use the list of the first array to call removeAll to delete the elements in the newly generated list.

A sass (human oriented enterprise service) Company

/*The following code finds the penultimate n-th element by giving the first element firstnode of a LinkedList. Please complete the code and correct the error so that it can be run directly through the Java command line. Testutil does not need to be implemented*/

[answer] the error to be corrected is that the findthelaselement method is not a static method and cannot be called directly with the test class name. The main method does not use the public modifier.

At the beginning, I thought the specific implementation was relatively simple. Because LinkedList is a two-way linked list, when I know the number of the first and the penultimate, I can directly go back three elements from the first. Call the prev of the first element to get the penultimate element, then call the prev of the penultimate element to get the penultimate element, and then the same method can get the penultimate element.

Later, when chatting with the first interviewer, if the two-way linked list is now changed to a one-way linked list, I think about how to realize this function, then I can realize it through two iterations. After the first traversal, I know the length of linekedlist. The length minus 3 is the target element. When I traverse the target element in the second traversal, I can get it directly.

Later, the interviewer said that although I could realize the function in this way, it was a little troublesome. Is there any other way? He gave an idea. For example, to get the penultimate element, you can save the first three elements. After traversing the last three elements, the saved elements will become the last three elements, and then know that the traversal to the last element is null. In this way, if the traversal to the first element in the last group ends, Among the three elements saved, that is the penultimate.

In this way, you can find the penultimate element in one traversal.

An internet education company (doing education and training for primary and secondary school students)

This company is quite wonderful. There are seven or eight pages of written examination questions. After finishing the interview questions, I talked with HR and let him go back. I asked why I talked with HR first. The result is that we invite many people to interview every day. If each interviewer interviews with the candidates, the interviewer can only interview one day. I ha ha, the interviewer's time is time, the candidate's time is not time? HR pretended to know nothing and asked technical questions. I'm also drunk. Well, a little off track. There are a lot of interview questions in this company. I am most impressed by the last three logic questions, and I can't remember the other questions. So just write out the last three logical reasoning questions.

1. The characteristics of Li Na, ye Nan and Zhao Fang meet the following conditions:

(1) Just two are very knowledgeable, just two are very kind, just two are gentle, and just two are rich;

(2) No more than three characteristics per woman;

(3) For Li Na, if she is very knowledgeable, she also has money;

(4) For ye Nan and Zhao Fang, if she is very kind, she is also gentle;

(5) For Li Na and Zhao Fang, if she has money, she is also gentle.

Which woman is not rich?

[answer] if Li Na has money, she is also gentle. According to conditions 1 and 2, if Li Na has neither money nor knowledge, she is also gentle. Therefore, in either case, Li Na is always gentle.

According to condition 4, if Zhao Fang is very kind, she is also gentle; According to condition 5, if Zhao Fang has money, she is also gentle; According to conditions 1 and 2, if Zhao Fang is neither rich nor kind, she is also gentle. Therefore, in either case, Zhao Fang is always gentle.

According to condition 1, ye Nan is not gentle. According to condition 4, ye Nan is not kind. Therefore, according to conditions 1 and 2, ye Nan is both knowledgeable and rich. According to condition 1, Li Na and Zhao Fang are very kind.

According to conditions 2 and 3, Li Na is not knowledgeable. Thus, according to condition 1, Zhao Fang is very knowledgeable. Finally, according to conditions 1 and 2, Li Na should be very rich, while Zhao Fang is not rich.

2. Sun and Zhang are students of archaeologist Lao Li. One day, Lao Li took an antique to test them. Neither of them could verify whose it belonged to. Lao Li told sun's owner's last name, Zhang's owner's first name, wrote down the names of the following people on the note, and asked them who they knew was the owner? The names on the note are: Shen Wansan, Yue Fei, Yue Yun, Zhang Fei, Zhang Liang, Zhang Peng, Zhao Kuo, Zhao Yun, Zhao Peng, Shen Kuo.

Sun said: if I don't know, Zhang certainly doesn't know.

Zhang said: I didn't know just now. I know now after listening to sun.

Sun said: Oh, I know.

Excuse me: whose is that antique?

[answer] according to sun, if I don't know, Zhang certainly doesn't know. This sentence can be judged that Zhang's name is definitely not "Wansan" or "Liang"; moreover, it can be determined that sun's surname is definitely not "Shen" or "Zhang" (because if Zhang takes "Wansan") , Zhang must know the answer, and sun can be sure that Zhang certainly does not know, then the "last name" sun knows is definitely not "Shen", similarly, it is not "Zhang"),

The remaining names are Zhao Kuo, Zhao Yun and Zhao Peng; Yue Fei, Yue Yun.

According to Zhang, I didn't know just now. After listening to sun, I know now. It can be determined that the name he knows is not "cloud" (if it is "cloud", after listening to Zhang, he still can't determine the answer, because there are two names with "cloud").

The remaining names are Zhao Kuo and Zhao Peng; Yue Fei.

In the third sentence, Sun said that he also knew that it was "Yue Fei" (if it was "Zhao Kuo" or "Zhao Peng" with two "Zhao" surnames, sun still couldn't judge it)

3. Fill in figures

three

thirteen

one thousand one hundred and thirteen

three thousand one hundred and thirteen

one hundred and thirty-two thousand one hundred and thirteen

one billion one hundred and thirteen million one hundred and twenty-two thousand one hundred and thirteen

( )

Which number should be filled in the last bracket?

In this problem of finding rules, generally, you will always find the rules of adding, multiplying, dividing, or multiplying back and forth, but the rules of this problem are still more interesting. The rules are numbers.

Just write it down.

3      3

13 1 3

1113 1 1, 1 3

3113 3 1, 1 3

132113 1 1, 1 3, 1 2, 2 1, 1 3

111312213 (read this number to get the final result) 3 1, 1 3, 1 1, 2 2, 2 1, 1 3

So the final result is: 311222113

Write at the end

In fact, making an interview summary is a supplement to the deficiencies recognized through the interview. In fact, when there is no interview, you have realized your deficiencies, but it is too late to make a temporary supplement. Some things are not temporary supplements. You should check and study in the future and adhere to the summary, Make future learning plans by recognizing your own shortcomings. The current plan is to design patterns - > java network programming - > linux knowledge - > data structures and algorithms - > in-depth understanding of microservices - > reading the source code of open-source projects such as spring and mybatis.

The interview will continue tomorrow. The more frustrated and brave, come on!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>