# IIT Delhi PhD Interview Experience

In this article, I have listed all the questions in order I was asked in my PhD Interview at IIT, Delhi for Computer Science. I have added notes on my answers as well so you can prepare along the way.

Overall, Interview took over 1.5 hour and was very intense to face in person. Thankfully, I am selected for PhD at IIT, Delhi in Computer Science. I went for full-time role. There were around 100 candidates and there were 5 panels of professors. Out of the 100 candidates, 9 were for part-time role.

In the panel assigned to me, there were 4 Professors from the Computer Science department of IIT, Delhi.

## Introduce yourself.

I gave details of my education background (B.Tech in IIT) and professional experience (2 years in Bangalore). I told them of my professional achievements that is the product I worked on, research work I did at company and more.

I mentioned technologies I have worked with (C++, Python) and domains of my expertise (Algorithms, Machine Learning).

## What is the time complexity of Quick Sort?

I answered O(N logN) on average with O(N^2) for the worst case considering standard implementation of Quick Sort.

Go through this article to understand Time Complexity of Quick Sort in depth for different cases.

For Time Complexity, I found this book to be helpful. This is a common and hence, important topic.

## Can you make the worst case to O(N logN)?

I explained different pivot selection strategies and how it impacts the time complexity. I explained Median of Medians algorithm.

Professor asked me to do the derivation of the range of median from the algorithm. Further, professor asked me how can I push an algorithm to worst case without any information about the algorithm.

To master this idea, go through these two resources:

## What is the base of log in the complexity notation? Can we change it?

The log notation has base 2.

Yes, the base can be changed. One standard example is 3 Way Partitioning Quick Sort. Frankly, speaking I did not mention the name but derived the concept on my own.

Professor mentioned the name of the algorithm I derived.

## What is the best time complexity for Sorting?

Professor 1 asked to be demonstrate a rough proof on the backboard. It took me around 10 minutes to mathematically explain the concept. It was difficult so I would advise you to practice at home. Understanding and explaining on board is two different things.

## If we can get O(N), why don't we use it always?

In this, we explained why Non Comparison based Sorting Algorithms can be used always.

## Can you sort a graph?

I explained the concept of Topological Sort.

One of the professors was not satisfied and was giving hints like:

• Flattening a graph
• Is it same as sorting a 2D matrix (adjacency matrix)?

I asked but the professor did not seem to be satisfied. I am not sure the answer or research he was hinting towards.

## You were waiting outside for this interview. Can you apply this idea to improve the process?

The professor wanted me to apply Topological Sort for this.

The challenge was to model the problem. I designed the problem as a scheduling problem with relations related to expertise of professors and candidates. I explained a Dynamic Programming solution instead.

## Q. If I roll 2 dice, what is the probability to get the sum as 5?

The possibilities are:

1 + 4 = 5
2 + 3 = 5
3 + 2 = 5
4 + 1 = 5

Total number of cases are 36 so the probability will be 4/36 = 1/9.

## What is 2^14?

I knew 2^10 = 1024 and 2^4 = 16 so, I gave a rough estimate of 16,000.

Professors were quite impressed. This is an important simple problem. Following are sample powers of 2 for your reference:

Power Value
2^0 1
2^1 2
2^5 32
2^8 256
2^10 1024
2^12 4096
2^20 10,48,576

## How many lines of code you have written?

I said over 30,000 lines of code easily.

I write 1000 lines of code on average in a month and have worked for 2 years + considering my work at College.

## At office, have you deployed a buggy code?

I explained how bugs can go unnoticed but whenever a bug needs to be fixed just before a release, we add a quick workaround patch.

## What is function pointer?

I explained function pointer and one of the professors asked me to write a small code snippet on the board to explain the concept.

#include <iostream>
using namespace std;
void my_int_func(int x)
{
cout<<x<<endl;
}

int main()
{
void (*foo)(int);
/* the ampersand is actually optional */
foo = &my_int_func;

return 0;
}

• How to initialize Function Pointers?
• How to pass functions as arguments to other functions?

## What is scope resolution operator in C++?

I got aware of this just a week before the interview so could give a brief idea. Professors were asking follow-up questions which were challenging and related to the support of this feature and problems that can arise from it.

I showed this code example:

// Use of scope resolution operator for namespace.
#include<bits/stdc++.h>
int main(){
// all these std :: was taken care by namespace but not defined so to avoid conflicts.
std::cout << "Hello World" << std::endl;
}

Explore this topic of Scope Resolution :: in C++.

## What is the diamond problem in OOP?

I explained the problem.

Professor asked if there is such a big problem, why does C++ allow it but Java does not. I gave the reason of the application targetting of the two language being different.

There was a follow-up question if one can add a similar feature of blocking this in C++? and if possible, what is the process?. I had seen some C++ proposals on web while searching for errors so had a brief idea.

Explore this topic of Diamond problem.

## Can you implement Quick Sort in the board?

It took me 15 minutes to implement on the board. Professors were interupting in between and asking questions on the implementation and how can I ensure it works correctly.

## Q. Name a subject other than Algorithms and ML in which you are confident.

I said "Operating System".

I would suggest to practice 3 to 4 subjects but mention only 2 subjects at the beginning.

## Can you name some scheduling algorithms.

I named multiple scheduling algorithms. Professors gave different scenarios and asked which scheduling algorithm will be best.

Go through this resource to understand different scheduling algorithms.

## Is SJF algorithm the most optimal? Prove it on board.

This took 15 minutes but I proved successfully. I have not seen the proof before.

Go through this proof SJF algorithm the most optimal and stay prepared.

## What is cache coherence?

I explained the concept.

Professor asked how can we use the information of cache coherence to optimize a program. I explained even though I had not analyzed this before.

## In C++, can you force a variable to be stored in L2 cache?

I had no idea of this so that to skip this. This created a negative impression as I had mentioned previously in the interview that I had worked on optimizations related to cache.

## Which operating system do you work on?

I said, Ubuntu and RHEL.

I explained further why I use 2 operating systems at work (mainly for testing).

## What is the command to check memory usage by different users?

I gave this command:

cd /home/
sudo du -sch *.

Professor asked me to explain each part of the command. They asked for alternatives.

## Explain watch command in Linux.

I said I am not aware of it.

The professors gave hint of where it can be used and asked me to predict the interface of the command. This question did not go well.

## What models have you used in ML/ Deep Learning?

I explained different applications I have worked on like Object Detection and Image Recognition and the models I have used like InceptionV3.

## You mentioned Backpropagation. Can you explain the concept.

I explained the concept of Backpropagation.

## In ML, how different models like GoogleNet are designed?

I proposed an experimental approach using which models can be designed and improved incrementally.

## How datasets like COCO dataset are prepared?

I explained the process. I had prepared a dataset for my B.Tech thesis so this was relatively easy. There were many follow-up questions which I asked to the best of my ability.

## Why you want to pursue PhD?

I explained my interest towards research and mentioned some examples of independent research I have conducted.

I mentioned the research works of some of IIT, Delhi's professors and gave brief idea of how I can take it forward.

## Have you found anything innovative before?

Yes. I along with my co-workers have filled for patent but I cannot disclose unless the work is publically available.

## Explain an unsolved problem you have worked on.

I explained the unsolved algorithmic problem named "Dynamic Optimality Conjecture".

This was the end of the interview. I thanked the professors for their time and left.

Later that week, the list of selected students was annouced and I was one of them.