# 488

Linux Engineer interview questions shared by candidates

## Top Interview Questions

Sort: Relevance|Popular|Date
Linux Kernel Engineer was asked...5 June 2009

### Write a shortest string copy function.

while(str++ = dst++) {}

I should be like the following. while (*str++ = *dst++) {}

or simplified to: while(*xptr++ = *yptr++);

### Print last n nodes of a linked list you only have pointer to Head

I suggest to create additional pointer which is the tail. Set a gap of the n nodes between the head and tail, move both, and once the tail points to null it’s the end of the list. Then, move only the head and print the node until it reaches the tail Less

Actually, that could work but it's too expensive. I suggest you to reverse the list which take O(n) time complexity afterward print first m element and reverse the list back which in total cost you O(n) time complexity and O(1) extra space Less

Use a queue. Traverse the list and add each element to the queue. Always check if the size of the queue is n, if so then remove the first element before adding a new one. When you finish traversing the list your queue will have exactly the last n elements of the list, just print them in order. Less

### Write an algorithm to sort an array of integers in O(n) time?

As it is array of integers radix sort can be used which has runtime of O(n). On a computer the size of integer variable is fixed, or constant, hence it become O(n). Any comparative sort will take O(n log(n)) but, the radix and buck sort are not comparative. Lets say the integer size is 32bits, then it's run time will be 32 * O(n), which is same as O(n) Less

There are a number of algorithms to do this one is called bucket sort. The interview didn't indicate the answer to me, but it seemed like he was looking for heap sort (which is O(nlogn) ).. Less

I believe your answer should be that no sort algorithm (on a sequential computer) can sort an array of numbers in less than O(n lg n) time. So his request couldn't be satisfied. Less

### You need to patch openssl. What is the quickest way or efficient way of installing the package?

# apt-get install pkgname , yum install pkgname, dpkg –i pkgname.deb # ./configure &amp;&amp; make &amp;&amp; make install Less

yum install openssl for rhel

yum update openssl

### What is fstab?

Fstab is the operating system's file system where we make the entry of mount point Less

Fstab is a file that contains details of all mounting points, they are mentioned there to make sure the mounting points stay mounted even after rebooting. Less

By the way, the default location of which is /etc/fstab

### When does the control passes from user mode to kernel mode in a Linux System?

System calls ,H/w Interrupts and last which I did not mention was Exceptions

Well! Exceptions are software interrupts which are synchronous while HW interrupts are asynchronous and caused by hardware devices connected to machine. Both types of interrupts are taken care by their respective interrupt handlers, the top halves. In either case, to service interrupts, execution switches from user space to kernel space. Less

### Subject were about automation, HA, performance investigation, Linux commands and how-would-you-approach-this-issue.

It's very specific based on the scenario. Think global when preparing.

There's quite an extended back and forth in actual interviews for questions like this, so nothing quite like real practice. The Prepfully Adyen Linux Systems Engineer experts have actually worked in this role, so they're able to do an honest-to-God accurate mock, which really puts you through the paces. prepfully.com/practice-interviews Less

### How to check services running on your computer?

top

systemctl --type=service --state=active

### What do you stand for as a Man?

Honesty, Integrity Family

Manual pages