Come see how many of these written test questions can be answered, all of which are correct, I'm afraid it's not a big deal!

Regarding the difference between epoll and select, which statement is correct?

[A] Both epoll and select are I/O multiplexing technologies, both of which can monitor the status of multiple I/O events at the same time.

[B] epoll is more efficient than select, mainly based on the I/O event notification mechanism supported by its operating system, while select is based on the polling mechanism.

[C] epoll supports two modes: horizontal trigger and edge trigger.

[D] Select can support small I/O in parallel and cannot be modified.

Answer: ABC

From the analysis of InnoDB's index structure, why can't the key length of the index be too long? If the key is too long, the number of keys that can be stored in a page is reduced, which indirectly causes the number of pages in the index tree to increase, and the index level increases, thereby affecting the efficiency of the overall query change.

How to restore MySQL data to any point in time?

Recovering to any point in time is based on regular full backup and incremental binlog backup. Restoring to any point in time After first restoring the full backup, the increased binlog is replayed on this basis until the specified point in time.

Enter ping IP and press Enter. What will happen before the packet is sent?

First, determine which network card to go according to the target IP and routing table, and then determine whether the destination IP is in the subnet according to the subnet mask address of the network card. If not, the network card address of the IP will be queried through the ARP cache. If it does not exist, the mac address of the destination IP will be queried through broadcast. After it is obtained, the packet will be sent, and the mac address will be cached by ARP.

Please explain why the Weibo system crashed when Lu Han posted his relationship, how to solve it?

"Reference Ideas" A. Get Weibo by pull or push B. The frequency of Weibo posting is much less than that of reading Weibo C. The Weibo of traffic stars is mainly treated differently from ordinary blogs, such as sharding. Also consider this factor

An existing batch of emails needs to be sent to subscribing customers, and there is a cluster (the number of nodes in the cluster is variable and will dynamically expand and shrink) to be responsible for the specific email sending tasks. How can the system complete the sending as soon as possible? Please elaborate on the technical solution! A. With the help of message middleware, task distribution is carried out through the publisher-subscriber model. B. Master-slave deployment, where the master assigns tasks. C. No middleware is used, and all nodes are equal. Through database updatereturning, mutual exclusion of tasks between nodes is realized

There are a number of meteorological observatories, and now it is necessary to obtain the observation data of these stations and store them in Hive. However, the Meteorological Bureau only provides api query, which can only query a single observation point at a time. So if you can easily and quickly get the data of all observation points? A. Call the api through shell or python, and the result will be temporarily stored locally, and finally the local file will be uploaded to Hive. B. Obtain the required data through the httpReader and hdfsWriter plug-ins of datax. C. The ideal answer is to call the query api in the UDF of the calculation engine, and store the query results of the UDF in the corresponding table. On the one hand, there is no need to export and import synchronization tasks; on the other hand, the distributed framework of the computing engine inherently provides features such as distribution, fault tolerance, and concurrency.

Given a linked list, delete the Nth node from the bottom of the linked list, and return the head node of the linked list. Given a linked list: 1->2->3->4->5, and n = 2. When the penultimate node is deleted, the linked list becomes 1->2->3->5. Explanation: The given n guarantees are valid. Requirements: Only one traversal of the linked list is allowed.

Reference answer

We can use two pointers instead of one. The first pointer moves n+1n+1 steps forward from the beginning of the list, and the second pointer will start from the beginning of the list. Now, these two pointers are separated by nn nodes. We maintain this constant interval by moving both pointers forward at the same time until the first pointer reaches the last node. At this time, the second pointer will point to the nnth node from the last node. We relink the next pointer of the node referenced by the second pointer to point to the next node of that node.

Code example:

public ListNode removeNthFromEnd(ListNode head, int n)
{
    
    
ListNode dummy = new ListNode(0);
dummy.next = head;
ListNode first = dummy;
ListNode second = dummy;
// Advances first pointer so that the gap between first
and second is n nodes apart
for (int i = 1; i <= n + 1; i++) {
    
    
first = first.next;
}
// Move first to the end, maintaining the gap
while (first != null) {
    
    
first = first.next;
second = second.next;
}
second.next = second.next.next;
return dummy.next;
}

Complexity analysis:

Time complexity: O(L), the algorithm traverses a list of L nodes. Therefore, the time complexity is O(L). Space complexity: O(1), we only use constant extra space.

If you are given a new product, from what aspects will you guarantee its quality? It can be guaranteed from three aspects: code development, test guarantee, and online quality. In the code development stage, there are unit testing, code review, static code scanning, etc.; in the testing assurance stage, there are functional testing, performance testing, high availability testing, stability testing, compatibility testing, etc.; in terms of online quality, there are grayscale releases , Emergency rollback, fault drill, online monitoring and inspection, etc.

Please evaluate the execution result of the program?

public class SynchronousQueueQuiz {
    
    
    public static void main(String[] args) throws Exception {
    
    
        BlockingQueue<Integer> queue = new
        SynchronousQueue<>();
        System. out .print(queue.offer(1) + " ");
        System. out .print(queue.offer(2) + " ");
        System. out .print(queue.offer(3) + " ");
        System. out .print(queue.take() + " ");
        System. out .println(queue.size());
    }
}

A. true true true 1 3
B. true true true (blocking)
C. false false false null 0
D. false false false (blocking)
Refer to answer D

Off topic

Due to too much information, this article is limited in space and only shares a small part of the information. If you need a full set of real interview questions (including answers to all questions), please click here. Code: qf
Recently, it is the best time to find a job. Everyone finds your favorite job smoothly!
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/w1103576/article/details/108646850