1st round:
11 logical assessment question based on some flow charts.
2nd round:
Coding round.
Interview 1:
Then , they asked me to do the initialization. I made a function for that. - Then , they asked me how would u solve it now? I told them my approach. - they asked me to show the syntax of that function n how would i call it? What all things will be used?
I made a static function in the class, in which i passed the whole grid.. Then i calculated all the possible values for each cell.
Interview 2:
(Important part was that they wanted implementation of all things and you had to do everything on board.)
- Tell us about yourself.
- What all subjects in Computer science u like ??
- Then they asked: Are u comfortable with OOPs? I said, yes.
He asked "Have u seen movie avatar"? I said, No. He said..does not matter..
Suppose there is a rocket , it contains a Spaceship.I want to send some people on Mars.People are there in the spaceship.Write a program to lend the spaceship on Mars planet. Make all the classes.
Then, they said, Suppose tomorrow i change my requirements, i want to send 'N' number of things top Mars , Or i may also send rocket empty,just for testing. Incorporate all these things in your classes n show us the main program, How all these classes are related, how will u make the spaceship lend on Mars.
It took around 20 mins in this question only. - Do u know about recursion. Write a program to print a given character 100 times.
- 2 more coding problems:
- Write a program to find 1st and 2nd maximum from an array.
I wrote it...I used swapping in the program at one place. Then they said..do it without swapping. - Given Input :: x1y2z3 Output :: xxyyzzz
I wrote the program Then they said, suppose input could be anything like
Input:: abc3defgh1aa3 Output:: abcabcabcdefghaaaaaa
Change your program accordingly.
- Write a program to find 1st and 2nd maximum from an array.
- Are u comfortable with DBMS ? What is normalization.
- Do u use Twitter..?? I said, No, I use facebook. They asked, u make post on ur wall.Simulate a database for this.What all table will u make.??
I made only 4 tables (since they were specifically asking about posts)- User's Table :: user_id , user_name , Place , d.o.b , rel_status
- Friend's Table:: user_id , friend_id
- Post Table:: Post_id , User_id , Likes , Post_text
- Comments Table:: Post_id, Comment_text , Friend's Id(who made the comment)
Then they gave me an SQL query:
Write a query to retrieve all the comments made by USER 'X' on all of his friend's posts.
I wrote the query using three nested sub-query.
They asked, Is there any other way of doing this?
I told it can be done using Views but I don't know how to do that. - Then, they asked , Have u heard about the sudoku game? Make a class for that and how will u solve the game , given some random values? What all data structure will u use? Give us the proper implementation. Would u take a 9*9 grid or how will u do that ?
I said i will make a class of 3*3 grid. N i will make 9 objects of that class.
How will u do that?
class sub_mat {
int a[3][3];
public:
. . .
}
int main() {
sub_mat sudoku[3][3];
}
Then , they asked me to do the initialization. I made a function for that. - Then , they asked me how would u solve it now? I told them my approach. - they asked me to show the syntax of that function n how would i call it? What all things will be used?
I made a static function in the class, in which i passed the whole grid.. Then i calculated all the possible values for each cell.
Interview 2:
- They again started with OOPS concepts.
They asked," u must have travelled in DTC bus ". Write a class and its member functions.
I made a class for vehicle..added data members (like model_no , price , serial_number , Type of vehicle , name..etc) then i added some functions like (start(),stop()...etc.)
I made a class Bus, I made vehicle class public to it. I added data members and functions for bus class. They wanted to add more and more functions. - Then, they said suppose there are three type of seats (Women, Senior citizen and conductor), how will u implement this thing in your class?
I implemented it using a 3*3 array in which i stored type_id for a particular seat and then a range for that particular type. - Then, they said, Suppose we do not have any range , we can give any seat randomly to anyone, how will u implement it now, and there can be 'n' number of types of seat. -I made a hash table kind of thing. Then they said there is lot of pointer kind of things in this bus class. Make a separate class for this data-structure for seats.
- Then they said, "you have also done Java, Is there any data-structure available in java for this ?" Implement that also.
- They asked.., shouldn't you categorize your vehicle class more,on the basis of type of vehicles. what all classes should be there and what all member functions should be in each class. (they spent half an hour on this question only.)
- You have done compiler , So tell us what is a linker and what is a parser? How do they work? Who call them when a program gets executed and to whom they return their values?
- Make a parser for a language in which i have data-types like :: tni a; taolf b;
- Tell us about various scheduling algorithms.
- How would u implement Remaining Time First ?? (I did it using min-heaps)
- What is preemption?
- What is Process Control Block? How does it gets implemented in memory?
- U have done K-means algorithm , Let me ask u a puzzle.
Suppose u have a Car , U have infinite amount of fuel , U have to go to some city "XYZ". U have never heard the name of the city, U dont know anything about it. U dont know in which direction it is and u cant get any information from any source. What strategy u will make to go to that city?
I asked, Sir , can u tell me the distance. He said, no, It can be anywhere..it can be thousands miles away in any direction.
My answer : I will first go straight from wherever i am , then i put a mark there, and take a circular round to ensure that place is not located in that radius.then , i again travel straight and take a circular round and so on until I find the place..
then he asked, Is it a BFS or DFS ?? I said, first we go straight (i.e. DFS) and then we take a round (i.e. BFS) , so it is a mixture of both BFS and DFS.
He said, Suppose now i am ready to tell u one hint, What will you ask for and what will be ur strategy? I said, tell me the distance.
He said, it is 10,000 miles away.
I answered, I will go straight 10,000 miles and take a circular round..:)
(Important part was that they wanted implementation of all things and you had to do everything on board.)
No comments:
Post a Comment