[Recommended collection] Selected PHP interview questions from many Internet companies

1. City Gang

It used to be affiliated to 360 company, a branch of 360, and now it is gradually independent and is an entrepreneurial company, mainly O2O. The interview content is as follows:

1. Talk about the project (he is more interested in the 360 ​​veteran project, other projects have not seen it), ask about the specific content of the project, the challenges encountered, the specific solutions, the use of cache, why redis is used, and why a separate file server is used .

2. Caching, I asked about the difference between memcache and redis, and the advantages of redis. How to solve the problem of low memcache hit rate, I asked memcache hit rate in actual projects. Whether the redis server has been deployed.

3. The difference between svn and git, let's talk about the specific workflow, the benefits of using git, and how to deal with conflicts. Two basic commands are written.

4. Database

(1) The storage engine of the database, the difference between myisam and innodb, name other storage engines besides these two.

(2) The difference between int and bigint, which primary key should be used in actual use? The difference between int(10) and int(11), the difference between var_char and char

(3) Database design, the benefits of separating the user table from the login table,

5. The php part

(1) The difference between session and cookie

(2) How to solve the problem of session sharing distributed (can be solved from the database, ccookie to save the session, nosql)

(3) The difference between get and post

(4) php __autoload mechanism

6. Computer network

(1) The process of three handshake and four wave hands (mainly drawing pictures), the meaning of each parameter

(2) The difference between http and https, how does https keep it safe (combined with ssl)

7. Data structure

(1) The structure of the linked list (linear and chain), insert the operation code of an element (written on paper)

(2) The sorting part, time complexity, write a sorting algorithm.

(3) The idea of ​​binary search, time complexity

8. Development environment, commonly used linux commands, the difference between apache and ngiax, whether the commonly used development environment is win or linux, etc.

Interview experience: The technical interview is about 50 minutes, and it is quite tiring. There are also questions about accommodation, transportation, graduation, internship time, arrival time, etc. hr people are good, the interview is not difficult as a whole, and they are all commonly used things. Algorithms must be easily written.

2. Sina Weibo

An Internet company whose mission is to serve the Greater China region and overseas Chinese. In November 2012, Sina registered users exceeded 400 million. The interview content made a set of papers, about 6 (single-sided), and the test questions are roughly as follows:

1. Why you want to join Sina and your impression of Sina

2. Future plans, goals, plans?

3. Is there a Weibo account, what is the nickname, and how many fans?

4. Fill in the blanks: (mainly write the result)

(1) Function to judge null

(2) Function to judge whether the variable exists

(3) Function to determine whether it is empty

5. PHP converts json to number: group function

6. PHP gets the date of the previous day in the following format (2015-08-24 10:20) and writes it to the file /usr/test

7. To extract the url, it is required to extract the url part from " sina " (two methods are required)

8. The maximum sum of consecutive sub-arrays. For example, the input array is {1, -2, 3, 10, -4, 7, 2, 5}. The maximum sub-array {3, 10, -4, 7, 2} and the sum is 18

9. Write common linux command functions: top, ps, mv, find, df, cat, chmod, chgrp, grep, wc

10. Write linux command to view port 80

11. There is an ip log file with one ip per line, counting the number of times a certain ip appears

12. Database design, there is a data field for publishing articles: article id, article title, publisher, category id, subcategory id, location id, creation time, status

Question: (1) Draw out the database design diagram (the relationship between the tables), and the tables can be added by themselves to explain the purpose and benefits of this design

(2) Write the statement to create the article table and talk about the basis for selecting the field.

(3) Write the sql statement to find the latest 10 articles and talk about the optimization method.

13. System design

Scenario: Now we want to create a user schedule reminder system. The requirements are as follows. It can record the user's daily schedule. When the agent schedule arrives, notify the user in the form of SMS or mailbox. The user can view the historical schedule and manage his own schedule (addition, deletion, modification Check), if the user has a friend, he can view the schedule opened by the friend and chat with the friend.

Requirements: 1: Consider concurrency.

2: The number of users is at the level of tens of millions, and the number of schedules is at the level of 100 million and 1 billion

3: Ensure safety and smooth homepage

4: Use a cache server

Question: (1) What do you think is the difficulty of this system?

(2) The relationship between the various modules of this system,

(3) The specific details of the implementation of this system (caching, big data)

(4) How to ensure the safety of the system

One side (technical side):

1. Mainly about the data sheet design of this system

2. This system may respond slowly when there are more users, how to solve it

Answer: Use the cache to solve frequent database lookups, the user's friend relationship, the friend's historical schedule, and my historical schedule can be cached. He asked what to do when the friend relationship changes. At the beginning, I said to clear the cache and query next time. Check the database directly. He said that this is not good. The pressure on the database will increase instantly. Let me think about it again. I said that I can clear the cache and then check the database to restore the cache. He said that it is not the best solution. Finally, he said that you can first Update the database, and then update the cache according to the updated friend relationship (the database is checked less once, which is actually very simple).

3. What should I do if the home page of this system loads slowly?

At the beginning I said that using static page, he said that the home page is dynamically loaded, page static has no effect, but will slow down the system, file IO needs to consume performance, let me think about other ways, I said to cache home page data, but Pay attention to the cache update time.

4. Login problem, the system login is slower slowly, do you know why and how to solve it

I said it should be because the number of users is too large, the login SQL statement is not optimized well, or the index is not added. He said that the index is added and the SQL is optimized to the best. What is the problem? I said that the number of users is too large It exceeded the single table capacity of mysql. He asked how to solve it. I said that it can be split horizontally to ease the pressure of data growth. What does he say is database split, and what is the difference between horizontal split and vertical split. I said vertical split solves the IO competition between tables and does not solve single tables. In the case of the pressure of data volume growth, put the tables that are not closed on other servers, and split horizontally to solve the pressure of data volume growth in a single table. It does not solve the IO competition between the table and the table. I feel that I am not too much. Understand, he said how to split the basis (I just understand the split) I said that it can be split according to time, he said, but this kind of splitting is useless, he said you think about it again, I said I feel OK, After the split, the single table data becomes smaller, and the query must be fast. He said how to determine which table the user is in when you log in? I said that in the hash, the relationship between users and sub-tables is hashed into a table. He said that it is not the best solution, and hashing is troublesome, and it is necessary to determine which table to search. . . He asked me to think about it again. From the point of view of stored procedures and database caching, he finally said that it was not good. He said that you can use the user name sub-table, and the user name (az) can be divided into 26 tables. I found the watch he was in. This question was discussed for about 30 minutes, and the answer was not very good.

5. Third-party login issues

He asked me if I had done a third-party login. I said that I tried it myself. I used QQ to do a third-party login, mainly calling the interface provided by Tencent. He also asked me about the principle of third-party login, the principle of the Austrian teacher certification, Talk about the secure transmission principle of https.

6. Interface

He asked me if I had done the interface. I said I did. He asked how the interface judges the user login. I said it was generating a token. He asked how the token was generated, how to solve the security of the token, what should I do if the token is hijacked? Good way. I don’t know how to deal with the token being hijacked. I can check this. Anyway, I didn’t think of a good way at the time. I answered from the token generation rules, expiration time, and token addition. He said it was OK.

Two sides: (technical, project interview)

1. Ask me why I want to join Sina Weibo

2. Talk about the project. He asked about the 360 ​​Anti-Japanese War veteran. He visited this website and asked about the system test, development details, and the caching problem. He also asked about the difference between mc and redis and the difference in memory management.

3. Visited my personal website and said that I can download the structure and deployment of the website

4. Ask me what kind of job I want to find, I said I want to find a website backend or app interface development job

5. Ask me if I have the most to learn new things, what new things I want to learn, I said I can look at nodjs and want to pay attention to php7

Summary: On the technical side, it takes about 60 minutes. I mainly asked about the database. I felt that I didn’t answer very well. On the other hand, I also asked about the project (the 360 ​​veteran, everyone is more sensitive to this project). The interview went to 12. : Around 30. The overall feeling is okay, the questions are all about database optimization, table splitting, big data processing methods and so on. Finally, let me wait for the result the next day. The next day hr called to say that the interview was passed, and I said about the internship. I went to work on Monday and went through the formalities on Tuesday.

Three, beauty theory

The largest female fast fashion e-commerce platform in China is committed to providing the most popular fashion shopping experience for young, fashionable and beauty-conscious female users. It has more than 100 million female registrations. The interview content has made a set of papers. The test questions are as follows:

1. MySQL index is that kind of data structure, why use this data structure.

2. Design a data table to store url information. This table will often be inserted and deleted. The application scenario is to find out whether a url exists. Please write out the table structure and add instructions.

3. Compare words a and b to determine whether the letters of word b are in a.

4. Write a timer class to count the running time of the application and write out the calling method.

5. The difference between session and cookie indicates whether session can still run after cookie is disabled

6. What is the amount of data generated by Sina Weibo in a year and how should the data be stored?

7. Is the status: the meaning of 204, 304, 404, please refer to (http://tool.oschina.net/commons?type=5)

8. Introduce the open source projects you know

One side (technical side):

1. Introduce the magic method of php

2. The leftmost principle of the index

3. The optimization of database sql, which sql statement execution will ignore the index.

4. Strategic issues: 4 people cross the bridge, a takes 1 minute, b takes 2 minutes, c takes 5 minutes, and d takes 10 minutes. Two people cross the bridge at the same time. The speed of crossing the bridge is the slowest one. After the bridge is over, one person sends the flashlight back and asks how long it will take to finish the bridge.

Two sides (technical side, problem):

1. Talk about the project, the 360 ​​veteran.

2. The browser enters the url to the page rendering, the process passed,

3. The difference between mc and redis, memory management.

Three sides (hr side):

Hr is a beautiful girl, and she had a good chat, mainly related to work plans, life and accommodation, university study experience, whether she knows Meilishuo this company and so on. Finally let me go back and wait for the notice.

Summary: Meili said that the company is quite large. On the one hand, it feels that the database is a bit difficult, mainly because the discussion on the underlying database is not very good. Regarding the question of the type of strategy, if you have not seen it, you can basically not type it, but you cannot say that you will not. You should give your own opinion, even if it is not completely correct. Finally, I went back and waited for the notification, saying that there is still another hr not here today, if I think it is possible, I will call on the 26th to notify me to retry. . . Finally, I really called me and asked me to retest, the time was the 27th.

Four, 360 Finance

Pen questions:

1. Write out the functions starting with array_ in PHP, and explain the usage, write at least 6

2, mysql commonly used storage engine, name more than 3, and write each application scenario, advantages and disadvantages

3. The difference between redis and MC, write one of the memory management mechanisms

4. View the command of Apache 80 port

5. Use C language to implement base64 encoding function in php

6. Write quick sort in PHP

Interview question:

1. The application scenario of redis in Weibo, the memory allocation mechanism of redis, why the use of redis is not suitable for MC, which is the higher concurrency of mc and redis

2. The usage scenario of array_map, array_merge(), the key name transformation after merging the array

3. The difference between several PHP encoding functions (json_encode, http_build_query, urlencode, etc.)

4. The meaning of * + / in regular expressions

5. Given a number, convert binary to hexadecimal

Five, the United States * net

Pen questions:

1. Print the date and time format of the previous day: 2016.03.18 10:15:12, print the date of the last day of the previous month

2. Tell the difference between empty() and isset() array_key_exits();

3. Enter www.baidu.com in the address bar of the browser and what happens in the future, and the protocol used

4. Extract the URL from the connection (< a href='www.meicai.com/index.html'>)

5. What is the difference between the method of sending mandatory requests in PHP

6. Write out 10 mysql field types to illustrate the usage scenarios

7. A data table, 70 fields, 10G data volume, 50w data increment per day, tell me what optimization methods are available

8. Write a timed task, call the PHP script /data/www/test.php every 10 minutes from 2 to 8 every day

9. Write a linux command to view the number of php-fpm processes

10. Write a function to judge whether the 5 cards randomly drawn from a deck of cards are straight or not. The definition of straight: 5 cards are consecutive cards such as 23456, where 2-10 are the original numbers, and A is 1. J is 11, Q is 12, k is 13, Xiao Wang Da Wang is any number.

Six, Guazi second-hand car

One side (technical side):

1. Introduce a written project, draw the architecture and technical points

2, coding Yang Hui triangle, find the value of m rows and n columns

3. Use regular expressions to judge the legitimacy of ip, and consider comprehensively

4. Memory management mechanism of redis and MC

5. Data storage methods in redis, various data structure application scenarios, what are the differences and advantages of redis message queues and professional message queues

6. The principle of the leftmost principle and the optimization mechanism of SQL, when will the index be used.

7. Optimization of sub-conditional query and system design and architecture

8. The new technology you recently learned, your understanding of the architect, and your understanding of the GO language, is it fast? Where are you soon?

Two sides (technical side):

1. The optimization mechanism of a SQL statement, big data paging processing

2. The regular traversal of the matrix, write the traversal code

3. The relationship between your boss and you, how to ensure the coordination of work and life, etc.

4. Grab the a.html page, and grab all the href in the note containing a. If the url contains guazi.com, put the url title on guazi, and then grab the page corresponding to the link, so as to keep Zunhua You crawl, how do you solve the infinite loop problem and the page crawl efficiency problem.

Seven, Baidu Takeaway

One side (technical side):

1. Talk about the project, introduce knowledge points, and draw structure diagrams

2. The meaning and usage of the leftmost principle of the database

3. A log file that prints the number of concurrency at a certain time (the number of records in the log)

4. An array is sorted by a fixed value (sorted by id)
$a = [
['abc'] => ['id' => 1,'value' => 233],
['bcd'] => [' id' => 2,'value' => 463]
]

Two sides (technical side):

1. Talk about the project

2. The leftmost principle of the database

3. The principle of establishing database indexes

4. Database engine, tell the characteristics

5. The advantages and disadvantages of redis and MC, in what scenarios are they used

6. In the print log file, the top 100 IPs that appear the most

7. Say the commonly used commands in Linux

8. The difference between PHP and other languages, the implementation of weak types in PHP

9. The difference between structure and union in C language, each occupies less memory (both have been given)

10. Are there some works written by myself or open source things?

11. System design: How to design the spike in Baidu's takeaway activities and what to pay attention to

Three sides (technical side):

1. Introduce the project, draw the process and development key points of a module you made

2. Did you learn new things, such as new technologies and languages?

3. Have you read the GO language, what are its advantages, and where is it suitable for use?

4. Why choose Baidu Takeaway

5. Why are you not willing to stay in the original company? What is the reason for leaving?

Four sides (technical side):

1. Introduce one of the most profound projects and state the technical points

2. Coding: an array 0-n-1, sorted, print out all i and j that satisfy a[i]+a[j] = c, and tell the time complexity

3. What are your future plans, learning goals or your own planning goals

4. What are the offers received and why did you not choose these companies?

5. How many people are there in the original backstage project, and where is the technical strength of each person?

8. Xiaomi Technology

One side (technical side):

1, write a class, a class single embodiment, input two arrays $arr1, $arr2each array there integer (0-9), this class provides two methods, a sort is $arr1, the two arrays is as a two Then subtract a large number and return the result (if the first array is [5, 2, 3, 4], it is equivalent to a number: 5234)

2. Explain the project, tell the knowledge points and own contribution.

3. The embodiment of two Cartesian products in the database in join, and tell us the middle process of left join

4. The meaning of the leftmost principle, the usage and optimization of database indexes

5. Reasons and solutions for slow website opening

Two sides (technical side):

1. Explain the structure of the project and the use of redis in the project

2. Why not stay on the original platform

3. Principles of database transactions, whether they have been used

Three sides (technical side):

1. Database optimization and index establishment principles

2. The meaning of database transactions

3. The difference between redis and MC, what are the data structures supported by redis

4. Using the framework, advantages and disadvantages

5. Magic methods in PHP

6. Have you ever used a front-end framework, have you learned js, jquery?

Four sides (technical side):

1. Why come to Xiaomi and how much do you know about us

2. Get the intersection of two arrays and their respective difference

3. For two tables, get their respective intersection and difference

4. The fields of the database index, which will use the index, and how to view it.

5. How to open PHP short tags. What is the impact of closing tags

6. The difference between session and cookie is the connection, how to ensure session synchronization under the cluster

7. The understanding of the architect, how do you think you can reach the architect

8. How to realize the three-column layout of div

9. Application of php frameworks, php security related

10. The optimization of the database, how to ensure the normal access of the large data volume database

11. The characteristics of database clusters and the mechanism of data synchronization

12. What is responsive design

Pay attention, don't get lost

Alright, everyone, the above is the entire content of this article. The people who can see here are all talents . As I said before, there are many technical points in PHP, because there are too many, it is really impossible to write, and you will not read too much after writing it, so I will organize it into PDF and documents here, if necessary Can

Click to enter the secret code: PHP+「Platform」

Insert picture description here

Insert picture description here


For more learning content, you can visit the [Comparative Standard Factory] Catalogue of Excellent PHP Architect Tutorials, as long as you can read it to ensure that the salary will rise a step (continuous update)

The above content hopes to help you . Many PHPers always encounter some problems and bottlenecks when they are advanced. There is no sense of direction when writing too much business code. I don’t know where to start to improve. I have compiled some information about this, including But not limited to: distributed architecture, high scalability, high performance, high concurrency, server performance tuning, TP6, laravel, YII2, Redis, Swoole, Swoft, Kafka, Mysql optimization, shell scripts, Docker, microservices, Nginx, etc. Multiple knowledge points, advanced advanced dry goods, can be shared with everyone for free, and those needed can join my PHP technology exchange group

Guess you like

Origin blog.csdn.net/weixin_49163826/article/details/108712975