You are on page 1of 10

How should a Computer Science student at VIT University prepare for

placement Interviews?

Answer taken from Quora. Must read. Contains very good questions. Do
solve them all.

Learn to Code.

But it is okay if you are not among the top programmers in the university. Firstly, a few things regarding
the interviews.

If you don't know the syntax of some function, then say "I can't remember the syntax right now.

When needed, I can ask my colleagues or look it up on the Internet." This will show your team-work
abilities as well.

Secondly, if you are asked a simple question, give the easy answer. "This question can be solved by using
"X Method" but

the efficiency is O(N^2). Let me try to come up with a more efficient solution". If you don't mention the
straight-forward

simple solution and instead spend five minutes trying to coming up with an efficient solution but can't,
then he will think

\that it took you five minutes to give the obvious, though inefficient, solution to such a simple question.

Ok now, for the resources, use these books. Number of questions and concepts from them that you will
be asked in your interviews isn't even funny.
Cracking the Coding Interview

Algorithm Design Manual (First-half of the book~350 pages)

http://mycppquiz.com/

http://mycquiz.com/

Regarding languages you should know.

C and C++ are ENOUGH!

For file-handling related questions, I personally used PHP to solve them, but you can use any that you
want.

People say Java and all are good, I guess it helps too, but I don't know even the slightest thing about Java
and this didn't hurt me at all.

"Important Concepts" [It's been an year, I can't remember exact things that were asked, but these are
the ones off the top of my head which EVERYONE should know]

Data-Structures: Binary Search, Hash-Table, Binary Trees, Recursion, Quick Sort, basics of Heap. Some
idea about dynamic programming and back-tracking. String manipulation-based questions are VERY
common also.

Operating Systems: Caching

Computer Networks: TCP/IP, OSN, Topologies.

Database Systems: MySQL, Normalization

Learn how to use qsort() function in C++.

Learn how to use hash-tables. It's okay if you can't code them. In such a case, learn how to use arrays as
hash-tables.
Learn how to use recursion, especially for binary trees.

And..here are some questions that were asked by first few companies (Flipkart, Paypal and Akamai)
during their placement interviews in VIT (July, 2012). Apart from these three companies, the list also
includes one question each from Amazon Interview and Directi, Facebook coding rounds.

1. Given a binary tree and values 'N' and 'K'; Find whether one and only one node exists in the tree with
the value 'N' and if it does, print all nodes at a distance of 'K' from that node.

2. Explain difference between QuickSort,HeapSort and MergeSort in terms of algorithm, complexities,


number of comparisons, worst cases. How can Quick Sort's worst case be improved?

3. Given a mountain, find its peak.

4. Given two rivers, find where they meet teach other and flow as one.

5. Given a linked list with a loop. Find the position where the loop occurs.

6. The Camel-Banana Problem. [Amazon]

7. Given a paragraph; find the longest palindrome.

8. Given two prime numbers, the difference of which is two; prove that the middle number is divisible
by six using logic.(Not mathematical formula of 6k+-1)

9. If one person throws a dart at a dartboard and hits it; whats the probability that the dart hit near the
center.
10. Given the ages of every person in India, sort them.

11. Write a program to simulate the colour-fill function available in MS-Paint.

12. Write a program to simulate Google Calculator. ( The client types an algebraic expression. Its
transferred to the server, the server parses it to get the operators and operands and sends the answer
back to the client. If the expression is an invalid, then a normal search is carried out instead of
calculation ).

13. Simulate the way how travel websites find you the least airfares between two cities; they need not
have a direct flight.(Keeping in mind that there are thousands of ways possible between two given cities
and you have to serve over a million people at a time)

14. If you were to start your own social networking site, how will you store so much data. And how will
you implement functions like find mutual friends, find common interests etc.

15. Given a tree with a loop. Find the loop.

16. You are given a box which has more boxes which have more boxes and so on.. Each box has been
labelled. Find a box of a given dimension. Which data structure will you use? Write an algorithm to
implement this.

17. Find the left-view and right-view of a tree.

18. Given a thread of uneven dimensions which burns in 1hour. Clock half an hour with it. With two
dissimilar threads which burn in one hour each, clock 45minutes. With just one thread, clock 15
minutes.
19. Prove that you cannot connect 9 dots without lifting your pen without visiting a dot again.

20. Database query to find the Nth-Max salary from given Employee Table.

21. Database query to display each employee's details along with manager details.

22. Database query to find maximum salary from the Employee Table.

23. When you type Google in your browser, what happens?

24. Explain the money-making strategy of Autonomous Systems.

25. If you open two tabs on firefox. And go to Yahoo! on both; and on one , you login to yahoo mail.
Why doesn't the other tab also get redirected to yahoomail.

26. If you open yahoomail on both firefox and google chrome; and you login to yahoo mail , can you
access yahoo mail on google chrome also? or will you have to login there separately. If you have to login
there separately, how does your university's wifi require login on only one browser.

27. Difference between HTTP get and post.

28. Explain any 30 linux commands.

29. You are given a pagaraph like "This is a line, this is a paragraph , this is a question". Write a program
which replaces each instance of "is" with a null. What'll be the output? Can you do this using just one
command? Write a program for it.
30. Given a directory with 1000 files, each having your name as their first line followed by random text.
Write a program to replace your name with my name.(You are just given the directory and not
filenames).

31. Define Hash tables, how are they useful? How are they different from Arrays?

32. Differentiate between Arrays and Linked Lists.

33. Speak ten minutes about the PPT.

34. Explain your projects( to a HR).

35. Explain your projects ( to a Tech).

35. Tell me about yourself.

36. Do you want to do higher studies.

37. Given N cars which have to be parked in N+1 parking slots such that ith car is parked in ith slot. At
present the cars have been parked randomly. Write a program which will park these cars in their correct
spots with minimum number of car moves. [Directi]

38. Given a room full of weights and balances such that some balances have weights on them. Some
balances also have some other balances on them. Each balance has a left and right side and is a digital
balance. A balance may have multiple other balances as well as a weight on either side. Write a program
to balance each balance in the room. Given that each balance weights 10KG and each weight weighs its
value.Also, there may be more than one way to balance various balances. However, the weight must be
added to the lowest balance. [Facebook]
39. Write a program to merge two linked lists.

40. Given a paragraph, find all anagrams.

41. Given two small words, find whether or not they are anagrams. What if you have to repeat the
procedure for 1000 small words?

42. Difference between HTTP and UDP.

43. Difference between TCP and IP.

44. How does TCP/IP work? On which layer they work?

45. On which layer does HTTP work?

46. Suppose you made a website, how will you check whether its up and running or not? Write a
program for it.

47. Your favourite programming language?

48. How much will you rate yourself in C++?

49. How much will you rate yourself in Data Structures? / Computer Networks / Database Systems.

50. Why do you want to join our company?


52. Suppose you join our company and are put in a team. Your team leader is a senior and takes the
credit away for all the work that you do. What'll you do?

53. You are in a team of 4. Only two people are working. Other two are free-riders. You are going to miss
the project deadline. What'll you do?

54. When was the last time you had a fight with anyone?

55. How can we improve our PPT.

56. Suppose you join the company and you're told that you have to work on Ruby and submit a project
within two weeks. And supposing that you don't know Ruby, what'll you do?

57. What does your father do? Why didn't you join his profession?

58. What does your mother do? Why didn't you join her profession?

59. List two of your weaknesses.

60. Disadvantage of pointers, how can it be countered?

61. Do you have a laptop? Which processor does it have? How is your i7 with base 2.0GhZ better than a
Pentium 4 with base 3.4 GhZ.

62. Difference between C++ and JAVA.

63. Binary Search.


64. Write a program to reverse a linked list.

65. Write a OOP class hierarchy to model the game of chess.

66. Write a code in any language to connect to a database for username/password authentication.

67. A street fight is going on where people have intentions of hitting one or more other people. Find the
minimum number of groups in which people must be divided so as to stop them from fighting each
other.

68. Given a tree, write a code to find all nodes at a depth 'D'.

69. Given a tree A and a tree B, write a code to determine whether B is a subtree of A.

70. Print all permutations of a string.

71. Given a string A and a string B. Find whether B is a rotated form of A. Example string A is helloworld
and string B is ldhellowor. Then B is A rotated twice.

72. Write a program to find maximum of two numbers without using any condition.

73. Write a program to add two numbers without using any operator.

74. Suppose you have a class with a copy constructor and a parametrized constructor. What one
problem can you see in this class? [If your reply is no default constructor, the counter question is "Why
do want to declare an object of the class and then assign it values thereby consuming two lines?"]
PS. The numbering in that question list is a bit-screwed. Ignore that. Or if someone can bother, please
correct it via 'Suggest Improvements'.

If you need clarification or solution to any question listed above, post in the comments or inbox me :)

Good luck for your interviews!! :)

You might also like