1. What is the opposite function for malloc () in C?Note: I imagine that in these rare moments you can be assumed to feel pride in your 35 years of programming in C, which is more than 40 years old.
I: free ().
Personnel: correct.
2. What Unix function allows a socket to get connections?Note: does it really qualify me as a network specialist?
I: listen ().
Personnel: correct.
3. How many bytes are required to store the MAC address?Note: I guess I just got a badge [Ethernet] ...
I: six.
Personnel: correct.
4. Allocate time-consuming: reading the CPU register, searching the disk, switching the context, reading the system memory.Note: The usual lectures on computer engineering in the first year of university.
Me: reading the register of the CPU, reading the system memory, switching the context, searching the disk.
Personnel: correct.
5. What is a Linux inode?Note: “metadata” is a more informative term than “file attributes”?
I: a unique file identifier for any given file system.
Personnel: wrong, this is file metadata.
I: the inode is an index that uniquely identifies a file in a given file system, and you can view this index to extract file attributes, such as size, time, owner, and permissions; You can even add your own attributes to such file systems.
Personnel: wrong, not “attributes”, this is “metadata”.
6. What Linux function takes a path and returns an inode?Note: Could it be that Google secretly got a license for the notorious chat bot Tay AI from Microsoft?
Me: I wrote a custom LIBC for G-WAN, our application server, but I don’t remember any syscall returning the inode.
Personnel: stat ().
I: stat (), fstat (), lstat () and fstatat () - they all return an error code, not an inode; they fill in the stat structure containing the file attributes named above, and not just the file inode.
Personnel: The answer is not correct: the inode contains all the metadata.
7. What is the name of the KILL signal?Note: I assume the observable is what happens when chat bots discover the existence of soft drugs.
Me: SIGKILL, with #define set to 9.
Personnel: No, this is “TERMINATE”.
Me: SIGTERM (15) is different from the KILL (9) signal.
Personnel: your answer does not match what is in my document.
8. Why is Quicksort the best sorting method?Note: For the Linux kernel (which Google relies on), Heapsort was chosen, not Quicksort ... for less memory usage and more predictable execution time.
I: this is not always the case, it does not even always fit.
Personnel: Quicksort has the best big-O rating.
Me: “big-O” ignores data storage delays, topology, size, available memory, and even the computational complexity of each CPU command involved in this procedure — instead, it simply counts the number of algorithmic operations! A “big-O” score may be a useful indicator in the design of algorithms, but the best solution for implementation and scaling depends on the specific constraints of each particular problem and environment.
Kadrovik: wrong, you should have given me the reason for the high mark of “big-O” from Quicksort.
9. There is an array of 10,000 16-bit values; How most effectively to count bits?Note: how much can this madness last? The 8-bit transcoding table can process the bytes sequentially one after the other, while the method based on a 64-bit mask processes 8-byte words simultaneously (moreover, modern CPU commands allow working even with 128-bit words, receiving a 10-fold gain in speeds, if not considered portability). Since the 64-bit conversion table is not available to modern computers, there is no doubt that it works faster.
I: it is necessary to shift the bits right on all 64-bit words using the Kernighan method.
Personnel: no.
Me: there are faster ways to process 64-bit words with masks, but I can't explain it by phone - you need to write code.
Personnel: The correct answer is to use the conversion table and then sum the results.
I: what type of CPU? Why not let me compare the results of my program and yours?
Personnel: it is not included in the task of this test.
I: what is the task of this test?
Kadrovik: I need to find out if you know the right answers.
10. What is the type of packets that are exchanged to establish a TCP connection?Note: if you have to read hex dumps of packages to find the cause of the failure, then 3-letter mnemonic codes will not help you find it in the dead network service. Perhaps Google should have stated that practical knowledge is not required for this work.
I: in hexadecimal: 0x02, 0x12, 0x10 - literally “synchronize” and “confirm”.
Shot: wrong, this is a SYN, SYN-ACK and ACK; if there’s a problem with Google, you need to know it in order to diagnose it. We stop testing because it is obvious that you do not have the required knowledge to write or analyze network applications. You need to examine the Linux function calls, how the TCP / IP stack works, and what “big-O” is, to possibly meet our requirements if you will have such an interview later. Good luck, goodbye!
Source: https://habr.com/ru/post/313028/
All Articles