Since I am a CS major, this time, I have decided to go over the 10 most recent interview questions @Google.
The function malloc is used to allocate a certain amount of memory during the execution of a program. The malloc function will request a block of memory from the heap. If the request is granted, the operating system will reserve the requested amount of memory.
When the amount of memory is not needed anymore, you must return it to the operating system by calling the function free().
listen(). For this one, I wasn’t able to find a clear answer. As I have read accept() is one of the functions that are called during the communication.
Although Unix sockets are a special file in the file system (just like FIFOs), you won’t be using open() and read()—you’ll be using socket(), bind(), recv(), etc.
When programming with sockets, you’ll usually create server and client programs. The server will sit listening for incoming connections from clients and handle them. This is very similar to the situation that exists with Internet sockets, but with some fine differences.
6 bytes. The MAC address is a unique value associated with a network adapter. MAC addresses are also known as hardware addresses or physical addresses. They uniquely identify an adapter on a LAN. MAC addresses are 12-digit hexadecimal numbers (48 bits in length).
4. Sort the time taken by: CPU register read, disk seek, context switch, system memory read.
CPU register read, system memory read, context switch, disk seek.
5.What is a Linux inode?
It’s a metadata. Uniquely identifies a file on a given filesystem, and you can lookup this index to fetch file attributes like size, time, owner and permissions; you can even add your own attributes on some file systems.
6. What Linux function takes a path and returns an inode?
stat(). So stat() returns inode(metadata)
7. What is the name of the KILL signal?
Quicksort BigO(n) worst case it’s n^2(when the elements are already sorted), best case nlogn. However, “big-O” ignores data storage latencies, topology, volume, available memory, and even the computational cost of every CPU instructions involved in a given implementation – instead, it merely counts the number of algorithmic operations! Big-O can be a valuable indication when designing algorithms but the best performing and scaling solution depends on the particular constraints of any specific problem and environment.
9. There’s an array of 10,000 16-bit values, how do you count the bits most efficiently?
Use a lookup table and then sum the results.
10. What is the type of the packets exchanged to establish a TCP connection?
SYN, SYN-ACK and ACK; if Google is down you will need to know this to diagnose what the problem is.
To be honest, If I were to see these questions on my interview I would get 1/10(I know a bit about Quicksort). If you read the original post, the interviewee has a huge working experience with servers and despite that he got rejected and wasn’t able to answer some of the questions. Holy crap!
Till next time,