PHP programmers Sohu 2019 interview questions and answers to resolve

First, multiple choice (a total of 27 questions, each question 5 minutes)

1. Read the following PHP code, and select the output ()

 

 

 

A、0

B、1

C、2

D、3

Reference answer: D

Answer Analysis: static properties of permanent memory

2.PHP singleton mode of operation described is wrong?

After A, singleton instance is established for the first time can be executed directly

Static member variables unique instance of B, require a kind of preservation

C, constructor and clone functions must be declared private

D, must provide a public static method to access this instance

Answers: A

Answer Analysis: PHP, a static member variables, whether all global variables or class, are page-level, each time the page is executed, will re-create a new object will be emptied after the page is finished, so it seems PHP singleton makes sense when it does not make sense, so PHP singleton pattern only occurs when multiple scenarios for a single page-level request and need to share the same object resources

 

3. The following mysql storage engine that is not the type of lock?

A, table locks

B, page locks

C, row lock

D, no

Answers: B

Answer Analysis: mysql is in myisam table lock, innodb row locks, lock-based index, where if conditions are not indexed, all the rows are locked; sql server only page locks

(Join the group 677 079 770 for more answers to interview questions.)

 

4. Which of the following is not a PHP language features?

A, open source

B, free

C, based on the client

D, convenient and efficient

Reference answer: C

Answer Analysis: features of PHP language are: open source, free and convenient and efficient.

 

5. About PHP mode modifier statement is wrong?

A, i case-insensitive match

B, m ^ beginning of the string will only match

C, x blank and # comments will be ignored

D, and the replacement string as php execution code evaluator

Answers: B

Answer Analysis: m is an enhanced line anchor mode, the front and rear \\ n will be considered as the beginning and end

(Join the group 677 079 770 for more answers to interview questions.)

 

6. With regard to Laravel middleware is wrong?

A, Artisan run the command make: middleware to create a new middleware

B, define front & rear intermediate

C, middleware proxy mode

D, middleware is an intermediary mode

Reference answer: C

Answer Analysis: Artisan run the command make: middleware to create a new middleware can be defined front & rear middleware

(Join the group 677 079 770 for more answers to interview questions.)

7. To activate the GD library, you must enable configuration file () command

A、php_gd2.dll

B、PHP.dll

C, PHP.ini

D、php_mbstring.dll

Answers: A

Answer Analysis: PHP in order to use the GD library must be enabled php_gd2.ll dynamic link library file

 

8. Regarding the socket in PHP, to say wrong is

A, socket connections may be established using the functions fsocketopen

B, working in the seventh layer, it may be based on TCP and UDP

C, the default timeout is 30 seconds in PHP

D, working in the fourth layer, may be based on TCP and UDP

Answers: B

Answer Analysis: Work in the fourth layer, it may default timeout in PHP based on TCP and UDP protocol is 30 seconds

 

9.JSON format of the data, the error is?

A, JSON a lightweight data interchange format

B, JSON with fully independent of the language of the text format, but also used language similar to C family habits (including C, C ++, C #, Java, JavaScript, Perl, Python, etc.)

C, these properties make JSON an ideal data-interchange language. Easy to read and write, but also easy to generate and parse the machine (network transmission rate).

D, values ​​are unordered list

Reference answer: D

Answer Analysis: The value is an ordered list

 

10. With regard to PHP array sorting principle, is wrong?

A, apply additional space n

B, doubly linked list traversal

C, will be sorted linked list of nodes in a single position changes, thus adjusting the designated point

D, provided the HashTable pListTail

Reference answer: C

Answer Analysis: 1. Application n additional space 2. 3. doubly linked list traversal function invocation sequencing zend \ _qsort (internal sorting algorithm is fast) ordering the sorted array, the doubly linked list node changes the position 4, thereby adjusting the designated 5. directed through the array, are provided, and each node pListLast pListNext 6. set the HashTable pListTail

 

11. With regard to Redis application scenarios, the following statement is not correct?

A, intersection, union, difference

B, counters, queues

C, Leaderboard

D, press releases

Reference answer: D

Answer Analysis: Cache - hot data, calculator, queues, bit manipulation, the latest list, distributed lock mechanism with a single thread, intersection, union, difference, charts, these are typical redis processing scenario. The answer is D

 

12. A description of the vulnerability scan, the following statements is false?

A, vulnerability scanning is based on remote detection of the target network or host vulnerability of network security technology, it can be used to perform experiments and simulated attack security audit.

B, vulnerability scanning to detect whether the target host system vulnerabilities, generally the target host particular vulnerability scanning.

C, vulnerability scanning is a passive preventive measures that can effectively prevent hacker attacks.

D, can be carried out according to the results of vulnerability scanning Ping scanning and port scanning.

Reference answer: C

Answer Analysis: Vulnerability scanning is an active preventive measures, can effectively prevent hacker attacks, possible trouble scanning is an active safety precaution

 

13.PHP program uses utf-8 encoding, the result is what the following program output?

 

A、9

B、13(gbk)

C、18

D、17(utf8)

Reference answer: D

Answer Analysis: strlen () function returns the length of the string. a utf-8 encoded characters are three characters, English characters 5 + 3 character \ * 4 = 17 characters Chinese

 

14. The same stacks and queues ()

A, abstract data types

B, the logical structure

C, storage structure

D, operations

Answers: B

Answer Analysis: linear form, the stack, the logical structure of the queue is the same, belongs to a linear structure. But they operate on different data, which show different characteristics

 

15. Why InnoDB table would suggest using an auto-increment a primary key?

A, using an auto-increment (INT / BIGINT type) as a primary key, which is the time increment the write sequence, and B + the number of leaf nodes sequentially consistent split

B, no

C, the table is not an auto-increment primary key is specified, and also can be selected not unique index (above conditions) the primary key, which when selected will InnoDB built ROWID as the primary key, and writing sequence consistent order growth ROWID

D, using an auto-increment (INT / BIGINT type) as a primary key, which is sequentially written from the time of increasing, the number of leaf nodes B + and split in the same order; auto-increment is not specified in the table as a primary key, but also can not be selected unique index (above conditions) the primary key, which when selected will InnoDB built ROWID as the primary key, and write-order consistency ROWID growth sequence; except, if InnoDB table and does not show a primary key, there may be selected unique primary key index, but that may not be unique index increasing relationship (e.g. a character string, the UUID, a multi-joint unique index field), the table access efficiency will be relatively poor

Reference answer: D

Answer Analysis: 1.InnoDB engine table is based on index-organized tables B + tree (IOT); 2. Each table needs to have a clustered index (clustered index); 3. all the rows are stored in the leaf nodes of B + tree (leaf pages of the tree); 4. clustered index based add, delete, change, the relative efficiency is the highest; 5. If we define the primary key (pRIMARY kEY), then it will choose as InnoDB clustered index; 6 If the primary key is not explicitly defined, the first InnoDB selects a unique index does not contain a NULL value as the primary key index; 7. If there is no such unique index, the built selects InnoDB 6 bytes long as an implicit ROWID containing a clustered index (writing rows ROWID as the primary key of the record is incremented, that unlike the ORACLE ROWID ROWID may be cited as implicit). Thus: 1. Since additional (INT / BIGINT type) as a primary key, which is sequentially written from the time of increasing, the number of leaf nodes B + and split in the same order; 2. This table does not specify an auto-increment primary key is also It can not be selected as the primary key unique index (above conditions), which will be selected when the built-in InnoDB ROWID as the primary key, and writes the sequence in the same order ROWID growth; InnoDB table 3. If a primary display and no key, there may be selects a unique primary key index, but that may not be unique index increasing relationship (e.g. a character string, the UUID, a multi-joint unique index field), the table access efficiency will be relatively poor

 

16. The correct statement is the following Javascript code?

 

A, a value of 0

B, obj2 obj1 cited method of

C, when executed call, this function in the point obj1

D, the final value is 6 obj1

Answers: B

Answer Analysis: Call the call, then obj2, add this to the point of obj2. Like obj2 obj1 method of borrowing

 

17. The following statement regarding references is wrong?

A, C is not a reference pointer

B, references are not permitted to use two variables point to the same content

C, reference can pass variables

D, a variable can be passed to the function by reference, so that the function can modify the value of its argument.

Answers: B

Answer Analysis: reference is allowed to use two variables to point to the same content

 

18.GoAccess although very powerful, but he can not do which of the following work?

A, generate statistics bandwidth statistics

B, may generate HTML report

C, can send an HTTP request

D, each HTTP status codes Statistics

Reference answer: C

Answer Analysis: GoAccess: is an open source, real-time, web log analysis tools run under the command line terminal. The tool provides fast, a variety of HTTP state statistics, you can make the administrator no longer entangled in all kinds of statistical data GoAccess mainly based statistics

 

19. With regard to the thread, saying the error is?

A, the thread is a physical process, is the basic unit of CPU scheduling and dispatch

B, which is smaller than the process of the basic unit can operate independently

The system has the same resources C, threads and processes

D, basically does not have its own thread system resources

Reference answer: C

Answer Analysis: thread refers to a scheduling entity within the execution unit in the process, but also the process. Basically thread does not own its own resources system

 

20. The argument about php file pointer is wrong?

A, feeek () moves the file pointer to a specified position

B, fcreate () is used to create a file

C, rewind () the file pointer to the beginning of the file stream

D, feof () tests whether the file pointer reaches the end of the file location

Answers: B

Answer Analysis: php open and create files are fopen () function, fcreate does not exist () function

 

21. Below is a function rather than the structure of the language is php?

A、eval()

B、require_once()

C、list()

D、empty()

Answers: B

Answer Analysis: just focused on the vital, reminded everyone pay attention to language structure and function php this point, it may be too much when we think empty, list, isset other such that the function does not actually on. Language structure list: echo () print () die () isset () unset () include (), note, include_once () is a function require (), note, require_once () is a function array () list () empty ()

 

22. The regular match which of the following string? / ^ Sjm /

A absjm

B、phpsjm

C、sjmphp

D, Fpsimd

Reference answer: C

Answer Analysis: The regular matches begin with the string sjm

 

23. Which of the following operating modes can be viewed php?

A、php -r phpinfo();|find / grep"Server API"

B、php -r "echo php_sapi_name();"

C、phpinfo();

D, above all

Reference answer: D

Answer Analysis: three operating modes can be viewed in php

 

24. The following inode is not included?

Read and write permissions A, file

Position B, the file

C, the current number of files in a directory

Timestamp D, file

Reference answer: C

Answer Analysis: inode information is stored in the file species, the number of bytes in the file, uid and gid, read and write execute permissions, timestamps, ctime, mtime, atime, number of links: How many file names pointing to this inode, file data block location

 

25. The result is the following code output?

 

 

A、1

B、2

C、3

D、4

Answers: A

Answer Analysis: if ($ str == 0), the string, and a digital comparator are equal, corresponding to the string $ str implicitly converted to digital, and then comparison, equivalent if (intval ($ str) == 0) . if ($ str == 0) is determined, and if (intval ($ str) == 0) are equivalent, while, and if ($ str) is not the same. IF ($ str) based $ str values ​​are not initialized. There is no value to pay, as long as the value of pay, it returns true. Of course you can also use $ str = "String"; if ($ str === 0) {echo "returns true.";}, Is to determine the data type and value $ str and values ​​are the same as the data type 0 before it can return true

 

26. The CSS style sheet associated with the HTML page, not the correct approach is () .

A, the CSS style definitions of the HTML document tag <head>

B, with a style sheet document introduction @import

C, in the HTML document <! - -> tag define CSS styles within

D, with a <link> tag links to access the online CSS style sheet file

Reference answer: C

Answer Analysis: HTML is annotated representation, where the definition of CSS styles invalid.

 

27. Which is not what PHP mode of operation?

A、CGI

B、FastCGI

C、apache2handler

D、apache

Reference answer: D

Answer Analysis: The first three are commonly used mode of operation, apache web server software

 

Second, multiple choice (total of three questions, each question 5 minutes)

1. After sub-library sub-table, how to deal with id primary key?

A, a single library generation increment id

B, set at the table or database sequence step increment field

C、UUID

D, snowflake algorithm

Answer: A, B, C, D

Answer Analysis:

snowflake algorithm

A, B, C are theoretically possible, but all have their drawbacks, preferably with snowflake algorithm.

snowflake algorithm is revenue distributed twitter id generation algorithm using Scala language, the long type id is a 64-bit, 1 bit is not used, bit 41 is used therein as a few milliseconds, with a working machine 10 bit id, 12 bit as a sequence number.

1 bit: do not, so why then? Because the binary in the first bit is 1 if it is, then it is negative, but we generate id are positive, so the first bit is a 0 uniform. 41 bit: it indicates that the timestamp milliseconds. 41 bit numbers can be represented by up to 2 ^ 41--1, i.e. 2 ^ may identify 41--1 millisecond values, expressed in terms of the adult, 69 years. 10 bit: recording work machine id, represents the service can be deployed on up to 2 ^ 10 machines which, namely 1024 machine. But in the five bit 10 bit behalf room id, 5 Ge bit on behalf of the machine id. Means that up to 2 ^ 5 Representative room (room 32), and each may represent a room where the machine 2 ^ 5 (32 machine). 12 bit: This is used to record different id produced in the same millisecond, the maximum 12 bit may represent a positive integer of 2 ^ 12--1 = 4096, which means that this number can be represented by 12 bit to distinguish one millisecond with 4096 in different id.

 

Share content limit from time to time :( join the group 677 079 770 for more answers to interview questions and learning materials.)

 ★ Tencent Senior PHP Engineer written questions 

 ★ one hundred million PV high concurrency scenarios order handling 

 ★ laravel development Lynx mall Component Services 

 ★ banners TV video broadcast infrastructure project combat 

 

 

 

Guess you like

Origin www.cnblogs.com/993089249a/p/11613149.html