Part of the 2017 Autumn Recruitment Written Exam Questions (php)

1. The output of the following code is

<?php
$a = "www";
settype($a,'array');
(string)$a;
floatval($a);
echo gettype($a);
?>

[Answer]: array

[Analysis]: For these forced type conversions, even automatic type conversions, this does not change the types of the operands themselves; what changes are only how these operands are evaluated and the type of the expression itself . If you want to change the type of the variable, you have to use settype();
2. For the existing table book, the primary key bookid is set as the identity column. If you execute the statement: select value1, value2 into book2 from book, which statement is correct?

A. If the table book2 already exists in the database, an error will be prompted.
B. If the table book2 already exists in the database, the statement is executed successfully, and the bookid in the table book2 is automatically set as the identifier.
C. If the table book2 does not exist in the database, the statement is executed successfully, and the bookid in the table book2 is automatically set as the primary key.
D. If the table book2 does not exist in the database, the statement is executed successfully, and the bookid in the table book2 is automatically set as the identifier.

[Answer]: A, D; Obviously choose A; B is definitely wrong, select into...
requires that the target table does not exist, because it will be automatically created when inserting. C. When selecting into to copy a table or table structure, only a "shell" is obtained, just like a cloned person, only a body is obtained, and personal consciousness and memories will not be cloned. The primary keys, foreign keys, constraints, triggers, and indexes of the original table will not be copied. D. The identity column means a non-empty auto-increment column, sometimes it is also called a label column, and a certain column is set to auto-increment.

3. The description of mysql index is correct:
A.mysql does not support full-text index
B.myISAM and InnoDB storage engine table default creation index is B-TREE
index
C.mysql currently does not support functional index, but supports prefix index

[Answer]: B
A. Mysql supports full-text indexing. The full-text index of the old version of MySQL can only be used on the char, varchar and text fields of the MyISAM table.
However, the InnoDB engine on the new version of MySQL 5.6.24 also added full-text indexing.
You can create a full-text index when you create a table, or you can add it by alter table, or you can create index directly
. B. Indexes belong to the concept of storage engine level, and different storage engines implement indexes in different ways. The MyISAM engine uses B+Tree as the index structure. InnoDB also uses B+Tree as the index structure, but the specific implementation is very different from MyISAM.
C.mysql now supports functional indexes. MySQL 5.7 introduces Generated Column (functional index). I haven't seen a specific definition of prefix index on the Internet. . .
4. What is the difference between this and self and parent in Php?
I didn't write down the specific options. The general survey content is as follows.
[Answer]
-This is to determine who it points to when instantiating. It is a pointer to the current object instance and does not point to any other objects or classes.
-self refers to the class itself, that is, self does not point to any instantiated objects, generally self is used to point to static variables in the
class-parent is a pointer to the parent class, generally we use parent to call the constructor of the parent class
parent::__constrcuct calls the construction method of the parent class

5. In the TCP protocol, if the server process restarts abnormally and can still receive client messages, then the connection can be disconnected by sending () messages?
A.URG
B.FIN
C.RST
D.SYN

[Answer]: C.
They are some fields of the fixed part of the header of the TCP segment.
A. Urgent URG, when URG=1, it indicates that the urgent pointer field is valid. It tells the system that there is urgent data in this segment
B. Terminate FIN , Used to release a connection. When FIN=1, it means that the data of the sender of this segment has been sent, and the transport connection is required to be released.
C. Reset RST. When RST=1, it indicates that a serious error has occurred in the TCP connection (such as a host crash or other reasons). The connection must be released, and then the transport connection must be re-established. RST set to 1 is also used to reject an illegal Message segment or refusal to open a connection, RST can be called the rebuild bit or reset bit
D. Synchronization SYN, used to synchronize the sequence number when establishing a connection, when it is equal to 1, it means that this is a request to connect or request to accept a message
6.Linux shares data through mutual exclusion locks and condition variables. When a thread is blocked by a condition variable, what is the command to wake it up
(the options are not remembered...)

7. Regarding the performance optimization of HTML Canvas, what is wrong is...
8. The time complexity of the following code is

int  func(int n){
  if(n<=l)return l;
  return n*fact(n-1);
  }

9. Which of the following situations belongs to the category of the strategy model ()

A.许多相关类仅仅是行为有差异

B.核心是采用面向对象的多态性的思想

C.需要经算法和对象分开,算法随它的客户而变化

D.避免暴露复杂的、与算法相关的数据结构
【答案】:ABD

Exam software engineering
strategy mode: Define a family of algorithms, each algorithm to encapsulate, and make them interchangeable. This mode allows the algorithm to change independently of the customers who use it. Also known as policy model

策略模式把对象本身和运算规则区分开来,其功能非常强大.**因为这个设计模式本身的核心思想就是面向对象编程的多形性的思想<**
算法使用客户不应该知道的数据。可使用策略模式以避免暴露复杂的、与算法相关的数据结构。

10. The relationship between deadlock and security state is ().

A.死锁状态有可能是安全状态

B.安全状态也可能是死锁状态

C.不安全状态必定产生死锁

D.死锁状态一定是不安全状态

[Answer]: D

11. For a flight system, the flight information needs to be entered manually. The flight information table is named HBXX, the number field of a certain flight is named HBBH, and the fare is pj. An employee had a hand error and assigned the flight number 0001 to the fare 99 The wrong input is 999, please modify it, the following statement is correct
A.UPDATE HBXX SET pj=99 WHERE HBBH='0001';
B.UPDATE HBXX SET pj=99 WHERE pj=99;
C.ALTER HBXX SET pj=99 WHERE HBBH=0001 ;

[Answer]: Definitely choose A.
12. The following belong to the JS modular specification are
A.CommonJS
B.NODE JS
C.ECMA javascript
D.AMD

[Answer]: AD
13. There are 1,000,000 records, which are divided into several sub-tables by block, and index is established. What is the size of each sub-table
A.1000
B.100
C.500
D.2000

[Answer]: A
survey: data structure-index
Write picture description here
14.

int a[2][3]={0,1,2,3,4,5};
int(*p)[3];
p=a;

The following address options are
A.*(a+1)
Ba[1]+1
C.*a[1]+1
Da[1]

[Answer]: A (He is a multiple choice question, other answers, I’m not sure...)

Check that the array pointer
p is a two-dimensional array pointer

15. There are 10 closed intervals, remove as few intervals as possible so that the remaining intervals do not intersect, at least a few can be removed

[1,100] [5,6] [6,7] [7,8] [9,18] [20,210] [70,99] [99,100] [70,100]
[101,102]

16,
the output of the following code is

int func(int x){
 int countx=0;
 while(x){
   countx++;
   x=x*(x-1);
   }
   return countx;
   }
  void main(char[]argv){
  cout<<func(135)<<endl;
  }

[Answer]: 4

Note that countx+; x=x&(x-1). The final countx is the number of 1s in the binary of x

17.
The output of the following code is

usigned int a =0xfffffff7;
char *b = (char *)&a;
unsigned char i = (unsigned char)a;
printf("%08x,%08x\n",i,*b);

[Answer]: ffffffff7
In X86 series machines, the storage of data is "little-endian storage". Little-endian storage means that for a data spanning multiple bytes, the low-order bits are stored in the low-address unit and the high-order bits are stored in the The high address unit, char b = (char* )&a, &a points to a pointer to unsigned int type data, (char*)&a casts &a into a pointer of type char*, and truncation occurs at this time. After truncation, The pointer b only points to oxf7 (why b points to the lowest oxf7 instead of the highest oxff? This is the little-endian storage just mentioned, the low-address unit stores the low-bit data, and because the pointer b is of char* type, it belongs to Signed numbers, so signed numbers output fffffff7 under the action of printf();
18. Directed graphs with directed edges {

int a = 3;
int b =4;
int c=  5;
int d = 6;
int m = 5;
int n = 5;
if((m=a>b)&&(n=c>d)){
m++;
print("%d%d\n",m,n);


}

[Answer]: 0, 5;

Looking at the priority and the && symbol, this kind of code is only supported in php and c++, and an error is reported in java. . .
First calculate (m)=(a>b); to assign a value to m, because a>b=0, so m=0; && symbol has a characteristic, the current condition is false or 0, it will not be Executed

So after m is assigned to 0, there is no more follow-up. . . n will not change, or 5.
[Note]: php, c++ written examination questions often take this kind of priority question, huge pit, you can practice this type more

You can look at this article, http://www.jianshu.com/p/5ab28ce6472a
are all very typical topics

to sum up

What I often test is the C++ pointer problem, the database index, and some basic operation statements.

As long as you test php, you must test topics related to priority assignment statements, as well as a small amount of front-end knowledge of Linux, and also test the TCP protocol of computer networks. Some calculations for weighted paths and graphs in the data structure will also be tested.

The database usually also examines its isolation level and transaction characteristics, and will test some knowledge points around its transaction characteristics, such as reading dirty data, phantom reading, and non-repeatable reading; database query optimization and concurrency control

Later, I found out that I often failed to get the answers to the questions I had done. I had the impression that I did it, but I couldn't remember the answers. . .

Guess you like

Origin blog.csdn.net/sinat_35803474/article/details/77621415
Recommended