Collecting and sorting out multiple-choice questions of Dayi Cloud 2021 for programmers written examination (15)

1. There is a one-to-many relationship between objects. When an object is modified, its dependent objects will be automatically notified. Which of the following design patterns is best?
A. Bridge mode
B. Observer mode
C. Adapter mode
D. Proxy mode

2. What function does the following code achieve? (^ is the exclusive OR XOR operator, C/Java/Python and the like all use this expression)
a=a^b
b=a^b
a=a^b
A. Use b as a padding number for a A kind of encryption
B. Exchange the values ​​of a and b
C. Calculate a to the power of b and assign it to a
D. Assign both a and b to a^b

3. 1000 bottles of reagents, of which 1 bottle is poisonous, if the mouse takes poisonous medicine, it will die after 24 hours. To find toxic agents within 24 hours, at least () mice are needed
A.10
B.512
C.1000
D.128

4. If the stack sequence is 123456, its pop sequence cannot be ()
A.456321
B.654321
C.653421
D.435621

5. Two equivalent threads execute the following programs concurrently. A is a global variable, and the initial value is 0. Assuming that the printf, ++,-operations are all atomic, which one is the output?

void foo(){
    
    
    if(a<=0){
    
    
        a++;
        }
    else{
    
    
        a--;
        }
    print("%d",a);
}

A.01
B.12
C.22
D.10

6. A computer often has multiple processors, each of which has its own different tasks. Some are used for drawing, and some are used for communication. The processor that undertakes the task of running system software and application software is called ()
A. Central processing unit
B. Controller
C. Host
D. Operator

7.以下正确的是()
A.
int a;
const int & ra=a;
ra=1;
B.
void bar(string &s);
bar(“hello word”);
C.
class A;
class B:class A();
B b;
A & ref = b;
D.
string foo();
void bar(string &s);
bar(foo());

8. The circular queue is placed in a one-dimensional array A[0,...,M-1], end1 points to the head element of the line, and end2 points to the last position of the end element. Assuming that both ends of the queue can be enqueued and dequeued, the queue can hold up to M-1 elements, and it is initially empty. Among the following conditions for judging whether the team is empty and full, the correct one is ()
A. The team is empty :End1==end2; Team full: end1==(end2+1) mod M
B. Team empty: end2==(end1+1) mod M; Team full: end1==(end2+1) mod M
C. Empty team: end1==(end2+1) mod M; full team: end2==(end1) mod (M-1)
D. Empty team: end1= =end2; full team: end2==(end1+1) mod (M-1)

9. Which of the following is not based on TCP protocol ()
A.HTTP
B.DNS
C.HTTPS
D.FTP

10. In the OSI reference model, what directly provides services for the session layer is ()
A. Application layer
B. Presentation layer
C. Network layer
D. Transport layer

11. The mysql database has a course selection table learn (student_id int, course_id int), the fields respectively represent the student number and the course number. Now I want to get the information about the number of courses selected by each student. Is the following SQL statement correct? ()
A .select student_id,sum(course_id) from learn
B.select student_id,count(course_id) from learn
C.select student_id,sum(course_id) from learn group by student_id
D.select student_id,count(course_id) from learn group by student_id

12. At the entrance of the telecommunications school recruiting interviews, a sign "No entry for those who don't understand computers" was erected. A group of interview students came, all of them who knew computers. Then they
A. may be allowed to enter
B. must not be allowed to enter
C. cannot be allowed to enter
D. must be allowed to enter
E. it is impossible not to be allowed to enter

13. Table structure design, try not to use default null, all fields should be set to not null as much as possible and define default values ​​for them. The following statement is wrong ()
A. NULl value does not use index
B. NULL on business You can replace
C.count(name) with 0 or an empty string, etc. C.count(name) can count the column whose name is null
D. As long as one column in the composite index contains a NULL value, then this column is invalid for this composite index

14. When a local user logs in to the system through the keyboard, the first program to obtain keyboard input information is ()
A. Command interpreter
B. System call service program
C. User login program
D. Interrupt handler

15. It is known that the post-order traversal sequence of the binary tree is dabec, the middle-order traversal sequence is debac, and its pre-order traversal sequence is ()
A.cedba
B.decab
C.deabc
D.acbed

16. Which of the following functions is the responsibility of the computer operating system? (Undefined item)
A. Abstractly define various devices of the computer as a unified interface to provide invocation
B. Compile the program code into an executable file
C. Run the shell script
D. Manage the computer's memory

17. What belongs to the linear data structure is () (indefinite item)
A. Stack
B. Queue
C. Figure
D. Tree

18. The sequence of in-order traversal is known as abcdef, and the leaf of the possible binary tree with the smallest height is () (indefinite term)
A.ace
B.cdf
C.adf
D.acf

19. Which of the following items are the capabilities of TCP () (undefined)
A. There is a connection
B. The data arrives in order
C. End-to-end flow control
D. Reliable data transmission

20. The search engine will record all the search strings used by the user each time through the log file, and the length of each query string is 1~255 bytes. Suppose there are currently 10 million records (the repetition of these query strings is relatively high, although the total is 10 million, but if the repetition is removed, it will not exceed 3 million. The higher the repetition of a query string, it means that it is queried The more users there are, the more popular it is. The 10 most popular query strings need to be counted. The memory required cannot exceed 1G. The following options are correct () (undefined)
A. All query strings can be stored Manage in memory
B. This hot statistical problem can be classified as a top k problem, which can be processed by heap sorting (time complexity is o(NlogK)), N is 3 million
C. Trie tree cannot be used to appear in the query string Counting the number of times (that is, mass data preprocessing)
D. Using hash tables can complete statistics on query strings within O(N) time complexity, and N is 10 million (that is, mass data preprocessing)

Guess you like

Origin blog.csdn.net/qq_34124009/article/details/108530261