ByteDance Summer Daily Internship Front-end Interview

This time the interview was for the Happiness Department of ByteDance. Originally, I didn't want to interview with ByteDance, after all, the difficulty of ByteDance's algorithms is widely recognized as high, and this happens to be my weak point haha. But a friend in the group insisted that I should give it a try, so I said, why not give it a shot, haha. However, I heard that the e-commerce and education departments were somewhat simpler, and I felt like I was being lured onto a pirate ship.

First Round

The first round was scheduled for 2021-03-31 18:00, and the interview lasted for 43 min. The timing was a bit awkward because by the time I finished the interview, it would be almost 7 o'clock, and there wouldn't be any food left in the cafeteria. As a die-hard foodie at Shanzhong University, I couldn't let this kind of thing defeat me. I even thought about eating while interviewing, but then I decided against it. I didn't want to make the interviewer hungry, so I went down at five o'clock, bought some food and ate until I was full. The interviewer was quite interesting, he kept swaying back and forth, hahaha. If it weren't for my self-restraint, I would have swayed too, but it turns out he liked to sway from side to side, whereas I prefer forward and backward swaying, hahaha. The interviewer was great, and he explained everything I didn't know, haha.

  • The process from domain name to IP is the DNS resolution process.
  • Is the second visit faster than the first due to caching mechanisms?
  • Does the browser block the parsing of dom when downloading css?
  • defer and async attributes of the <script> tag.
  • How do two tab communicate with each other?
  • Encryption process of https transmission.
  • Features of http2.
  • Linux command, how to kill a Node process.
  • Concept of database transactions.
  • How does a server record a user's login state?
  • How to distinguish reference types, such as determining whether a is an Object or an Array.
  • Result of [] == !([]).
  • Implementing a singleton pattern.
  • js is single-threaded, how to achieve asynchronous behavior.
  • Click event flow, i.e., js event flow model.
  • const, how to make object properties unchangeable.
  • Based on which attribute of the parent element are margin-top/padding-top, explained by the interviewer, as the child element actually affects the height of the parent element, so using height bilaterally could cause a loop.
  • How is responsive layout usually implemented.
  • Differences between px, em, rem, rpx.
  • How to turn an entire page gray, i.e. transform the entire document into grayscale filter: grayscale.
  • transform: translatez(0) attribute, the interviewer explained that this can improve performance by placing it on a new layer.
  • Various types of watcher in Vue, render-watcher, computed-watcher, watch-api.
  • Parent-child lifecycle order.
  • Implementing Promise.all.
  • Implementing a breadth-first search for a multi-way tree, defining the custom node structure of a multi-way tree (only need to define the node structure, no need to build the tree), and searching for nodes that meet the requirements in a breadth-first manner (if no nodes meet the requirements, return null), such as looking for user information with phone number phone by calling: let node = wideTraversal(node, (e) => e.phone === phone).
  • Puzzle: There are 100 tigers and 1 sheep on an island. Tigers can eat grass, but they prefer to eat sheep. Assume: A can only let one tiger eat sheep at a time, and once it eats the sheep, it turns into a sheep. B all tigers are smart and completely rational, their first priority is to survive. Will the sheep be eaten in the end? What if there are n tigers and one sheep?
  • Write the result of executing this code.
async function async1() {
    console.log('async1 start');
    let a = await async2();
    console.log('async1 end');
}
async function async2() {
    console.log('async2');
}
console.log('script start');
setTimeout(function() {
    console.log('setTimeout');
}, 0)
async1();
new Promise(function(resolve) {
    console.log('promise1');
    resolve();
}).then(function() {
    console.log('promise2');
});
console.log('script end');

This interview was quite fun, it was the first time I met an interviewer who explained everything to me, really nice. Also, the interviewer wrote a summary for each question, so it was very easy for me to organize everything in the end, haha. I was scheduled for the second round within half an hour, so the efficiency was really impressive.

Follow-up

Originally, the interview was scheduled for Friday, but then because of getting vaccinated and a class schedule change, it got delayed again. Then I rescheduled for the second round on 2021-04-06 11:00. During the interview, the team leader told me that I, at 23 years old, needed to intern continuously for six months, and those who were 22 could intern for three months non-continuously. At the time of the internal referral, the person told me that I could intern for three months non-continuously, haha, maybe he was also unclear about it, but I won't go and play with him anymore. The team leader said that the first round of the interview went pretty well, but then it turned out like this, it felt like I played a prank, pretended to interview with Baidu and then said the timing wasn't right, haha.