Zomato - SDE Backend Intern Interview
Currently - Final Year CSE Student
Applied Offcampus for SDE Intern 6M Role using Referral
Final Result - Offered Internship
Interviewer was an SDE-III @ Zomato
Question-
Why did I use MongoDB instead of MySQL in my internship project? In general, what tradeoffs are there b/w using Mongo vs SQL? Why and when to use?
Follow-up: I was explaing a part where I used indexing on one attribute, so the interviewer switched the entire discussion to what are Indexes and how do they work.
Question-
Lets say you have a table with Index on A and Index on B (seperate indexes, not composite).
How would a query perform and work on the backend when it has some condition like - SELECT ALL WHERE A=10 and B=20 ; he wanted to know how such a query would be processed when A and B are seperately indexed.
Follow-up: Is it better to index A and B seperately, or make a composite index AB? In either cases how would the above query perform? which is time / space efficient and why?
I told the interviewer that I had no prior knowledge about types of indexes, but we can try to solve it by thinking how the backend might work, and he agreed. So we spent some time breaking down to the very atomic level of how indexes might be working.
After spending quite a lot of time on this, we decided to move further, and he wanted me to do a design problem now.
Question: To design an Attendance System with the following requirements
teacher, dean, student, etc and different views for different role.He wanted me to show him Database Structure, APIs, logic, and also design LOGIN system for same and explain how it would work.
I think I spent quite a lot of time on designing the DB because it was my first SD interview, but after I created the tables and all, we discussed about some optimizations which I managed to accomodate and then we moved to login.
Asked me difference between Hashing vs Encrypting, couldn't answer clearly.
In my login design, I mentioned about creating a session id, which will be sent from user in GET calls when they want to see the dashboard, and will help us to authorize user to the particular view.
Question - If someone else obtains your Session ID, how will you prevent them from logging into the account?
I thought about logging the IP Address of the user on the backend, and making sure that each request for a particular session id comes from the same IP, but he then gave me a follow up-
Follow-up: What if someone has same IP address as yours? What'll you do then?
I tried to think of many approaches, but eventually got out of answers and surrendered.
Duration of Round was almost 1 hr 25 mins.
Received call from HR the next working day informing me that I cleared R1.
Interviewer was Engineering Manager
Starting Phase
Zomato since 9 years.said not to include things written in the Resume.I clearly mentioned, that I am not at all a DSA Guy, and that I have spent most of my time in BTech doing projects and understanding business side of tech.
Question - Tell me about he most challenging technical problem you ever faced.
I explained a hackathon project and the interviewer seemed satisfied after asking 1-2 follow ups that were just for clarification purposes.
Question - Puzzle
10 boxes labelled as [1,2,3,4…..10] (identifiers)
100 apples inside each box - 1kg each
I choose 1 random box and replace all 100 apples inside that box with 0.9kg apples
Identify the identifier of that random box, given that:
Interviewer gave me a timeline of 2 mins to solve, which I obviously couldn't. We tried for about 5 minutes, but eventually skipped the problem to move further.
Question
head & tail of a Double Linked List (DLL), delete all the nodes with a value that falls in the Fibonnaci Series that has an upper bound of N.I gave an approach, which seemed optimal to me, but then the interviewer asked me to think of another solution, possibly better than this. I gave another solution, better than the previous one in terms of time, but more space was required; and then he asked me for another solution. I gave him the 3rd solution, and still he asked me for a 4th solution; then 5th solution.
After creating like almost 4 solutions, that were pretty much same in terms of space and time, he asked me to pick one and code it. Clearly mentioned that he is not interested in syntax at all, but logic should be correct in the first go i.e. no loose ends in terms of deletion, series generation, etc.
I decided to code an approach that was less optimal than the best solution I proposed, which amused the interviewer. I did this saying that the
best approach I proposed wasn't maintainable and would have poor readibility and understanding for any other person looking at it.The interviewer didn't show literally any sign of either satisfaction / disstatisfaction, which made me pretty underconfident, but I decided to keep my stand of chosing to write the more readable approach.
He evaluated the pseudocode, and seemed satisfied after a few simple follow up questions.
Ending Phase
Gave an extensive feedback, which was positive, and appreciated me taking the stand of writing readable code over optimal code, justifying that it was a very good decision to go with the less optimal one there. He also mentioned that he was never looking for an optimal answer, but rather was interested in me making multiple solutions to the same problem.
Duration of Round: 1 hr 20 mins.
Received the call from the HR in exactly 24hrs to schedule next round.
Interviewer was VP of Tech in Gurgaon Office.