Sling Media Interview for 5 year experienced C Developer
I. Written round
1. A program was given which creates node in a linked list and then frees the nodes.
Each node in Linked List contain the following :
a) integer value
b) a char pointer -> memory has been dynamically allocated during creation of new node
c) next pointer
In the free function they were freeing the node without freeing the dynamically allocated char pointer.
Task was to identify this memory leak and correct the code accordingly.
2. WAF to print all prime numbers in the range of N to M
3. WAF to search a string (might contain spaces) in another string and replace all occurances with a new string
a) Buffer space should not be used.
b) String should be replaced in place.
4. Design Air Traffic Control System
a) Landing time required for a plane = 60s
b) Only one run-way is present in airport
c) If run-way is blocked for a flight, return the waiting time and waiting slot number
d) Waiting queue is infinite
5. One thread is incrementing a variable. Another thread is printing the variable.
Synchronise these 2 threads using 2 locks.
II. F2F Interview
1. Questions on the projects done.