You are on page 1of 5

1. given hash table of bucket size 3, how will you insert a new element.

2. code to count number of words


3. given 2D array of bits (black & white screen), how will you draw a horizontal line with given co-
ordinates ?
4. difference c, c++, java.
5. virtual functions
6. general questions on code modularity, function arguments & global variables.
7. stricmp function to compare 2 strings that are case insensitive
8. reverse an array of bytes
9. puzzle: apple, orange, apple + orange waali.
10. Shuffle cards in 2 ways:
(a) given n, push last n cards on top
(b) given n1, n2, push cards n1 to n2 on top.
11. given a 2d array of 1's & 0's find the maximum number of contiguous 1's.
12. given an array of -1, 0, 1, sort in 1 pass.

1. Find point of intersection of two linked lists


2. Find the mid point of a linked list in one traversal(length is not known in advance)
3. Least common ancestor of two nodes a and b, in a BST (or binary tree)
4. Given a string T of length n, and a smaller string S of length m. Delete all occurrences of S from T if S
and T are saved in a linked list.
5. Given vertices of a triangle, and another point P, how will you find out if P is inside the triangle or
outside.
6. Print a matrix in a spiral.
7. Given an ip address in a dotted decimal representation. Write a function that checks if IP address is
valid or not (according to standards of IP address)
8.
9. Write test cases for every such problem (the problem listed above)
10. Puzzle :- A bag has 5Black n 5White Socks...How many max times u need pick the socks... to be sure
of geting 1 Pair of Black/White.

1a. write a program validateIP to check whether the inputted IP


address is valid or not.
b.Write 12-15 test cases
c. check whther ur program checks for all the cases

2a. given an input string, reverse it. length of string is not known.
b. test cases

3. given a matrix mXn of integers. print the intergers in spiral


fashion. for example for the following matrix
1 2 3 4
5 6 7 8
9 10 11 12
the output is 1 2 3 4 8 12 11 10 9 5 6 7.

they were very much focussing on the test cases


round1:
imagine a gui which has n pages and m rows on each page. intially the user is at x1,y1 position( x1 being
the page number and y1 being the row ON THAT page)...he gives you aa destination position say
x2,y2...now you are supposed to find an algorithm which gives y ou the shortest possible way to reach the
destination page.
various functions availabe are

1. page up(brings u to the first row of the appropriate page)


2. page down
3. down(down by one row)
4. up(up by one row)

the pages are in circular fasion ie if u do page up fromhe 1st page you reach nth page
time : approx 50 mins

round 2:
question 1:
given a set of problems which can either be solved by the linked lists or stacks or queues or arrays or a
combination of more than one of these...draw a venn diagram showing this s et of problems.
answer was a simple circle as all of the data stuctures can be implemented using the other. hence all the
portions overlaped completely.
question 2:
test cases for reversing the linked list...
time:around 45 mins

round 3:
question 1: why do u want to join ms??
question 2: if we ask you manager or mentor what do you think they would say about you??
question 3: write an algorithm to shullfe a pack of 52 cards..
question 4: what are the differences between an array and a linked list....
question 5: three baskets...with wrong lables of orange apple and mixed...a very common puzzle...i was
supposed to find the right labling by picking only one fruit from one of the baskets...
time: arnd 1 hr 10 mins

round4:(AA)
talked about the project for 20 mins...
then a simple question on arrays....input :aaabbbccddd
output:a3b3c2d3
input:abbccc
output:ab2c3
and then write test cases for the same....
time:arnd 49 mins

1). Suppose in a binary tree, you can get the parent node of every given node (say through a function
node *par_node (node *) ). Given a node of this tree, write a code to get the immediate right sibling of this
node. [No extra space to be used].

2). Write a function to rotate (left) a given integer array n number of times.
[No extra space].

3). Implement semaphore.


4). Some basic Qs of OS.

5). Describe your project at MS.

1. three color balls RBG in an array sort in single pass...


2. Tell wether the tree is balanced or not.Balanced if Max -Min=+-1

where Max is maximum height of tree and Min is minimum height.

3.A hash table is given.it is like linked list of keys and each key node has a data linklist associated with
it.No. of keys is N and bucket size is B. insert a node in it.

4.Print a tree level by level.eg


1
2 3
4 5
6

output:
1
23
45
6
PS:you have to change line after each level

5.for Y in linked list prob write a production quality codei.e assuming user can give all possible i/p eg.two
list that never meet,two circular lists
6.string reversal e.g
i/p: IP is mad
o/p: mad is IP.
7. stricmp() code
8.given pid and given two time t1 and t2 wap to give how many process are running since t1,died etc till t2
9.give time in hr and min tell the acute angle made by clock hands at that time (production quality code)
10. Y in linked list with loop at tail.... return the y junction

1. Write a program to reverse a linked list k nodes at a time.


E.g - if linked list is : a b c d e f and k=2 then output should be b a d c f e

2. Write a program to find all permutations of a given smaller string in a larger string.

3. Write a program to print all valid bracket strings of a given length.

For e.g with n=2 valid combinations are (()) and ()()

Selection for Internship


Interview 1 (at the time of internship selection) - By Sharad Sharma

1) Write a program to do this - Given a sentence "Hello I am IP", your program should convert it to "IP am
I Hello"
2) Tell the differences between Thread and Process
3) What is a threaded tree and why is it used ?
4) There is a software which takes as input three sides of a triangle a, b and c, and tel ls that which type of
triangle it is (eqilateral, isoceles etc). Write test cases for testing this program.
5) How do we multiply a number by 7 without actually multiplying it.

Interview 2 (at the time of internship selection) - By Rajeev Kumar

1) Given a tree, whose each node contains some numbers. Write a function which calculates the sum of
nodes at each level (returns array of sums)
2) Write test cases for above program

Selection As FTE
Interview 1 (after internship) - By Sanjay Nair

1) Tell me about your project during internship (this will definitely be asked)
2) Given a bag containing a few balls of any number of colours, write a program which selects a ball at
random, and organizes them in a sequence such that balls of same color appear together.
3) Write test cases for this above program.

Interview 2 (after internship) - By Sudeep Bharti

1) Tell me something about yourself


2) Which is your favourite subject ? Teach me this subject for 20 minutes.
3) Given two linklists L1 and L2, merge them such that their elements appear alternating i.e. first L1's first
elements comes, then L2's first element comes, then L1's second element comes, then L2's second like
that.... Also, this should be converted in place, that is, no third linklist should be created as an auxillary,
only modifications in original linklist allowed.
4) Write the test cases for the above program, and test them one by one.

After this I was informed that there will be some more interviews when Microsoft visits BIT

Interview 3 (at BIT) - By Akshay

1) Given a tree, and a pointer to any one of the node, design an algorithm and find i) the just right sibling
of that node ii) all the right siblings of that node iii) all the siblings of that node (i.e. all the nodes at that
level) [This question is a bit complicated than what it looks - we have to take care of a lot of things while
designing the algorithm for this question - also the same algorithm can be used for solving all the parts of
question with little modification]
2) Write exhaustive test cases for the above
3) Write tests cases of program that reverses the sequence of words in a string. He wanted me to write
test cases such that it also checks the efficiency of program i.e. time, complexity etc
4) Asked about the internship project at Microsoft - what was the project, what did I do etc.

Interview 4 (at BIT) - By Hari

1) Write the best program which you will use to find whether there are duplicates in a string or not. The
program will stop once the first duplicate is located. Write test cases.
2) Find the third largest element in an array of numbers. Write test cases.
3) Design Microsoft Word for people who have very week eyesight.
4) Asked about my internship project - the same usual things.

Interview 5 (at BIT) - By Ganesh Pandey

1) How were your previous interviews. What do you think about them [this is a typical question to test
confidence - if this question is asked - assume that they were happy with your previous interviews]
2) What is your final year degree project [I explained him what my project aim was]
3) Design data structures for your final year degree project. [it became very very very complicated -
probably the toughest problem I have solved]
4) Design test cases for your final year project.
5) Write a program - given the coordinates of two rectangles (only upper left and lower right), find the
coordinates of the rectangle formed when the two given rectangles intersect.
6) Write automation test code for the above program.
7) Use the rectangle intersection program as an inverse to test itself.
8) Write test cases for rectangle intersection program.

quest 1>convert base 2 no into base -2?


quest 2>reverse a link list using recursion i)using method returning
the start node
ii)using
method of void type return
quest 3>add 2 nos in two different linklist each digit of nos are in
different nodes
quest 4>find the depth of tree
quest 5>mirror of the tree
quest 6>inorder, preorder,postorder,level order traversal without recursion
quest 7>check if tree is balanced or not

asked to give test cases for all of the above questions

quest 8>what is reentrant code


quest 9>something related to semaphores was asked

You might also like