Immediately on Christmas, I wish you 🎄 happy in advance!! In this article, I will share with you my fifth Tencent site and sixth technical manager, let you have a happy Christmas!

Because this is the last article of this series, so here also released the link of the previous article, the partner that has not read, can go to the previous article to consult first!

Interview part 1

Interview part 2

Just for a chat

Yesterday, I shared the second article, and found that many partners asked for answers in the comments section. Here I would like to state that the author will only provide answers to some questions, and the author will not provide answers to some open questions, so as to avoid limiting your thinking, I would like to say sorry here.

preface

In the fifth interview (on-site interview), the boss of goose factory also asked me about the background of the questions related to the project. Most of the other questions were about data structure, algorithm and safety. The details of the interview are as follows.

Background Note:

The author’s project experience is mainly a lecture system based on wechat environment (designing a chat system with text, voice, pictures and facial expressions).

1. How does this system ensure the real-time push of messages?

Nodejs + websocket(socket.io)

2. How is message withdrawal function implemented?

3. Sometimes websocket will be disconnected. How to solve the problem?

Add a heartbeat mechanism. Blah, blah, blah.

var heartCheck = {
    timeout: 60000.//60ms
    timeoutObj: null.serverTimeoutObj: null.reset: function(){
        clearTimeout(this.timeoutObj);
        clearTimeout(this.serverTimeoutObj);
        this.start();
    },
    start: function(){
        var self = this;
        this.timeoutObj = setTimeout(function(){
            ws.send("HeartBeat");
            self.serverTimeoutObj = setTimeout(function(){
                ws.close();// If onclose would reconnect, we would reconnect to ws.close(). A reconnect would trigger onClose and cause the reconnect to occur twice
            }, self.timeout)
        }, this.timeout)
    },
}

ws.onopen = function () {
   heartCheck.start();
};
ws.onmessage = function (event) {
    heartCheck.reset();
}

ws.onclose = function () {
    reconnect();
};
ws.onerror = function () {
    reconnect();
};
Copy the code

4. Which sorting algorithms have been used?

Steal a map to see, 😝

5. Describe how merge sort is implemented.

6. Do you understand the Diff algorithm inside React? What would you do if you had to design it.

7. What do you know about security? (I’m not going to go into this, there are a lot of questions here)

XXS, CSRF, SQL injection

.

That’s it for the fifth interview. The interviewer leaves for 20 minutes and says you can go back. We’ll call you later! I reiterated to the interviewer that I was from Guangzhou. Then the interviewer said, please wait a moment while I talk to the manager.

.

After about 15 minutes, the manager came over and he said, “I’m not going to ask about the technology, let’s have a chat!” The manager told me about the current business of the project team, the technology stack mainly used, and suggested me to read more books on data structure. Still have asked how to look to working overtime!!

That was the end of the long goose interview, and the long wait! About 20 days later, I received a call from the technical staff, but I still needed to meet with HR. At that time, I had already joined the new company, so there was no further discussion!

conclusion

happy christmas !

@Author: Even