Please note that I am a fresher from one of the IITs. So, the interviews for the same companies might be different for non-freshers.
Brief Intro about the company: Arista Networks is the name of the company, that I got interviewed for. It is a networking start-up company.
The interviews I had for this company are very different from the ones that I had before. They gave me a laptop to work on and the interviewer was sitting right infront of me on another laptop, looking at what I was doing, by 'ssh'ing in to my laptop. They weren't keen on asking questions related to a specific topic. Rather, they were just looking at how sharp the candidate is. There were just two rounds of interviews, pretty big ones though with each one lasting about 2-3 hrs.
Round-1 Interview:
The interviewer asked me questions to test my familiarity with Linux. He was not just asking about basic linux stuff, he asked me to find out the memory layout for a process. He asked me questions about /proc filesystem. How would I go about using the /proc filesystem to extract the information corresponding to each running process. He was completely obsessed with acronyms. He says "copy-on-write" is called "COW". I have NEVER heard of such an acronym. Huffff!!! It was a very tiresome job and I was absolutely lost!!!
Then the second part of the interview starts, which is about the Algorithms and Data structures (my favourite!). Here are the questions:
Q1. Given a pointer to a node in Binary Search Tree, return the next inorder successor of that node.
Straight forward code. Kids stuff! :P
Q2. Given a binary tree, write a function which would return true if the tree is a valid binary search tree or false if the tree is not a valid binary search tree.
Straight forward again! He was a bit impressed that I solved them without taking any hints.
Q3. Given a linked list and a number, remove all the nodes in the linked list whose 'key' value is equal to the given number. For example, given the linked list 5->6->1->3->5->5->7->8 and number 5 as input to the function, the function should modify the linked list as 6->1->3->7->8.
This again, pretty straight forward kids stuff! :P :P
Then he tells me that he was absolutely worried about the first part of my interview. I realized that he wasn't impressed with the first part, at all. But, he was happy with my second part. However, I still don't know whether he would select me or not.
Round-2 Interview:
This guy is an absolute genius. He seems to have quite some experience with the networking and stuff. He asked what would be my favourite area. I said operating systems. And then he started.
Q1. How would two processors inter-communicate with each other?
I told him things about Advanced Programmable Interrupt Controller(APIC). And then I realized that I got the question incorrectly. The questions was:
Q1. How would two "processes" inter-communicate with each other?
I told him that this can be done using shared memory, signals, memory queues, etc. He asked me to explain the signals a bit more. I told him about how the signals are generated and how they are handled in uniprocessor and multi-processor systems. I knew what I said was correct.
Q2. This is a very hypothetical question that he had asked me. There are two processes running and you want to send a text string from one process to another process. And the only way these processes can communicate with each other is by using signals. He asked me not use shared memory/message queues etc. Like as I said, the only way of communication between these two processes would be through signals.
I gave a very wacky solution. Convert the string into a binary string. And assign two signals (let us call them SIGX and SIGY), one to the binary '1' and the other to the binary '0'. For the bit '1'(/bit '0'), process-1 sends the signal SIGX(/SIGY) to process-2 and in the signal handler of SIGX in process-2, it sends a signal(let us call this as SIGZ) to process-1 as an ack for the signal received. After receiving ack from process-2, process-1 transmits the next bit in the same way and so on. (You would understand why I am doing this if you know how signals are handled in the linux kernel). He seemed to be satisfied with the solution.
Q3. He asked me questions about the memory management in linux. How is virtual memory handled and how is that converted into physical address and so on.
Q4. He asked me the difference between Arrays and Linked lists. Pros and cons for both of them. I even told him about dynamic arrays and how are they implemented. Asked me to analyze each of them interms of the resources available in the system(memory and cpu time). Took me to the systems level.
I think I have done a good job in answering this question.
Q5. There is memory(RAM) of size 32GB and you want to count the number of times the word 'a' occurs in the entire memory. How would you go about solving this problem on a (i) uni-processor machine and (ii) a multi-processor machine.
I told him that parallelization can be done on a multi-processor system where as, single thread would be more efficient on a uni-processor system. Reason: On uni-processor multi-threading leads to unnecessary overhead because of context switches.
That's all folks! I haven't been told the result yet and I think they might not select me.