Home> headlines> body text

2022 Xiaomi Senior PHP Engineer Interview Questions (Mock Exam Paper)

Release: 2021-12-29 14:14:27
forward
24193 people have browsed it

Read more about the company's interview materials before the interview, which will be very helpful for subsequent interviews. Today I will bring you the 2022 Xiaomi Senior PHP Engineer Interview Questions (Mock Exam Paper), which has a certain reference value. I share it with you now, hoping to help everyone!

2022 Xiaomi Senior PHP Engineer Interview Questions (Mock Exam Paper)

Related recommendations: "2022 PHP Interview Questions Summary (Collection)"

1. Which function can be used to convert errors into exception handling?

A:set_error_handler
B:error_reporting
C:error2exception
D:catch

Correct answer:A

Answer analysis:set_error_handler() can specify a callback function. When an error occurs, it will be automatically handled through the specified callback function. Just throw a new exception in the callback function.

2. Which of the following shell function descriptions is correct?

A: The shell function can be called first and then defined
B: Shell functions need to be defined using the keyword function
C: Variables within the shell function can be declared as local variables
D: The shell function can only return a value through return, 1 is success, 0 is failure

Correct answer:C

Answer analysis:The shell function must be defined first before calling; when declaring, there is no need to use keywords; it can be passed through local Define local variables within the function; shell function return value, 0 is success, non-0 is error, other options are correct

3. The following statements about full-text search technology are incorrect:

A: Solr is a new generation of full-text search component. It is much more efficient than Lucene's search. It also supports HTTP access. It is also very convenient for PHP to call Solr.
B: In MySQL, full-text retrieval can be achieved by establishing a FULLTEXT index on a field. Currently, both MyISAM and InnoDB tables support FULLTEXT indexes.
C: Sphinx is a SQL-based full-text search engine that can be combined with MySQL for full-text search. It can provide more professional search functions than the database itself.
D: The binary word segmentation analyzer CJKAnalyzer that comes with Lucene is very fast in word segmentation and can meet the needs of general full-text retrieval.

Correct answer:A

Answer analysis:Solr is a new generation of full-text retrieval component. Based on Lucene, so saying it is faster than Lucene is nonsense:)

4. What is wrong about the singleton mode?

A: The purpose of the singleton mode is to ensure that only one instance of a class can exist in the global environment
B: The single-interest mode generally requires that the constructor be set to private
C: You only need to set the constructor to private to ensure that there is only one instance in the world
D: The function of connecting to the database is usually implemented in the singleton mode

Correct answer:C

Answer analysis:Setting the constructor to private only ensures that new instances cannot be created through new, but it can still be cloned and deserialized. Create multiple instances using methods such as transformation.

5. What is the wrong expression of the regular engine?

A Regular engines can be mainly divided into two categories: one is DFA and the other is NFA.
B Generally speaking, NFA engine searches faster. However, DFA is expression-oriented and easier to manipulate, so most programmers prefer DFA engines!
C NFA expression dominates, DFA text dominates.
D You can use whether it supports ignoring priority quantifiers and group capture to determine the engine type: NFA is supported, DFA is not supported

Correct answer:B

Answer analysis:The correct statement should be: Generally speaking, the DFA engine searches faster. However, NFA is expression-oriented and easier to manipulate, so most programmers prefer NFA engines!

6. Which of the following options can be matched by the regular expression in the box?

/.\123\d/

A. **123
B. ****1234
C . 1234
D.123

Correct answer:B

Answer analysis:The key point of this question is to understand this The meaning of the regular expression - from left to right, first there are zero or more arbitrary characters (.), followed by an asterisk (), then 123, and finally a number. So the answer is B.

7. Which of the following statements about databases is wrong?

A: For efficiency, the database can have multiple reading libraries
B: The database can use master-slave for hot standby
C: The database cannot provide a multi-master and multi-slave architecture
D: The database master-slave is through Log synchronization

Correct answer:C

Answer analysis:The database can provide a multi-master and multi-slave architecture.

8. Which of the following is not a way to repair XSS vulnerabilities?

A: Perform htmlspecialchas filtering on parameters
B: Use whitelist filtering on parameters
C: Do not allow input content to be displayed in the browser
D: Disable Output the content entered by the user in the js tag

Correct answer:A

Answer analysis:This Class filtering can solve the angle bracket type XSS, but cannot solve the XSS in js tag

9. Which of the following is not a PHP SAPI mode?

A.ISAPI
B.CGI
C.FastCGI
D.RESTFUL API

Correct answer:D

Answer analysis:A~C are the most commonly used patterns, and D is an interface organization method.

10. To traverse a large file line by line, which of the following methods has higher performance?

A: Write a class that implements the IteratorAggregate interface, and use foreach traversal through this class.
B: Use file_get_contents to load the file contents into memory at once, and then traverse line by line.
C: Call the shell tool traversal through the exec function
D: Use a class library written by others

Correct answer:A

Answer analysis:Using IteratorAggregate can open the file and traverse it line by line by moving the pointer, regardless of the file size. Using file_get_contents to process large files can easily cause PHP memory overflow; calling exec will create additional processes and affect performance; the quality of class libraries written by others may not be high.

11. Which of the following options is not a principle that the design pattern should follow?

A: Composition is better than inheritance
B: Programming for interfaces
C: Reduce coupling as much as possible
D: Try to use high-performance syntax

Correct answer:D
Answer analysis:The focus of design pattern is on the maintainability and reusability of the code, option D is not design Key points to focus on.

12. Which of the following expressions about backtracking is wrong?

A ab.lmn matches abcdeflmnghijklmn in abcdeflmnghijklmn
B ab.?lmn matches abcdeflmn in abcdeflmnghijklmn
C ab??c matches abcdeflmnghijklmn
D.*lmn matches abcdeflmn in abcdeflmnghijklmn

Correct answer:D

Answer analysis:D is a greedy match, So the matching result should be abcdeflmnghijklmn

13. If the try catch finally syntax structure is used in the function, where should the return be written?

A: finally
B: try
C: catch
D: Anywhere

Correct answer:A

Answer analysis:try will continue to execute after return in finally. If there is also return in finally, the final return value will be the value of return in finally.

14. The following statement about NOSQL is incorrect:

A: Redis supports strings, hashes, lists, sets, Data structures such as ordered sets, currently Redis does not support transactions.
B: MongoDB supports the AP in the CAP theorem, and MySQL supports the CA in the CAP, all of which support the impossible existence.
C: MongoDB can directly insert data without first creating a Collection structure. Currently, MongoDB does not support transactions.
D: Memcache supports both TCP protocol and UDP protocol. We can store PHP Session in Memcache.

Correct answer:A

Answer analysis:Redis supports transactions.

15. Which statement about Innodb lock mechanism is wrong?

A: Innodb provides two lock mechanisms: table lock and row lock
B: Innodb’s table lock will be triggered when the table changes
C: Under Innodb When updating, exclusive locks will be automatically added to the rows involved and a mirror copy will be created. At this time, when selecting, the data of the mirror copy will be queried
D: Reading will not be affected in the Innodb row lock state, but writing will Affected (data involved)

Correct answer:A

16. Which of the following is created every Wednesday? Execute the crontab command every 3 minutes from 01:00~04:00?

A: 1,4 3 /bin/bash /home/sijiaomao/ok.sh
B:/3 1,4 3 /bin/bash /home/sijiaomao/ok.sh
C:/ 3 1-4 3 /bin/bash /home/sijiaomao/ok.sh
D:/3 1-4 * /bin/bash /home/sijiaomao/ok.sh

Correct Answer:C

Answer analysis:A: Executed every minute at 1:04 every Wednesday B: Every 3 at 1:04 every Wednesday Execute once every minute C: Meet the requirements D: Execute once every 3 minutes at 1:04 every day

17. Before splitting, there are many data required for lists and details pages in the system This can be done through sql join. After splitting, the database may be distributed on different instances and different hosts, and join will become very troublesome. Which of the following methods is not an effective solution to this problem?

A Global table, some tables that all modules in the system may depend on are saved in each library.
B Field redundancy, while saving the "Seller Id" in the "Order Table", the seller's "Name" field is also redundant, so that there is no need to query the "Seller User Table" when querying order details.
C Master-slave replication separates reading and writing of the database.
D Data synchronization, the tbl_a table in database A is regularly associated with the tbl_b in database B, and the specified table can be synchronized from master to slave at scheduled intervals.

Correct answer:C

Answer analysis:Master-slave replication separates the reading and writing of the database. It can only expand read concurrency, but cannot alleviate the problem of cross-database joins.

18. Regarding the network IO model, which of the following is correct?

A.Select is faster than Epoll
B.nginx uses the select model
C.apache supports switching between select and epoll
D. epoll can support greater concurrency

Correct answer:D

Answer analysis:A epoll is faster. B nginx uses the epoll model. C apache only supports select

19. When PHP is executed, there is the following execution process: Scanning (Lexing) - Compilation - Execution - Parsing, their meanings are:

A: Convert PHP code into language fragments (Tokens), convert Tokens into simple and meaningful expressions, compile expressions into Opocdes, and execute Opcodes sequentially
B: Convert PHP code Convert to language fragments (Tokens), convert Tokens into simple and meaningful expressions, execute Opcodes in sequence, compile expressions into Opocdes
C: Convert PHP code into language fragments (Tokens), convert expressions Compile into Opocdes, execute Opcodes sequentially, and convert Tokens into simple and meaningful expressions
D: Convert PHP code into language fragments (Tokens), compile expressions into Opocdes, and convert Tokens into simple and meaningful expressions. Meaningful expressions, sequential execution of Opcodes

Correct answer:C

Answer analysis:The correct answer is C, The correct order is: Scanning (Lexing), Parsing, Compilation, Execution

Related recommendations:

1,2018 – 2022 Front-end JavaScript interview questions (collection)

2,front-end interview Jianghu

The above is the entire content of this article, I hope it can be helpful to everyone's learning helped. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

Related labels:
php
source:微信公众号
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!