Pages

Tuesday 11 September 2012

microsoft interview pattern and some questions

microsoft interview pattern and some questions  from nit trichy 2012



Two fields IT and IDC

technical interview:

1.implementation of malloc
2.given a string replace spaces with %20
3.atoi implementaion
4.given a list,a part of list is reversed  write a optimized program to sort
   1 2 3 6 5 4 7 8 9
  so 6 5 4 is reversed
5.dubly linked list to binary search tree

6.given filte is going to land but conditions are not good then what u will u do (this is not technical questions)

Direct i paper pattern in 2010 and 2011


Latest Directi Placement Papers 2010
Package: 10Lakh
Paper Type: Mostly Technical but they allow to appear all branches Students(CSE,ECE,CE,Civil..)
Experience: Question is base on C/C++/Algo ,OS(little) ,Puzzles mixed Apti.

Questions: 30 questions are there and you have given 45min to solve.
All Questions are multiple type. I just mention the questions options not remember.
1. What is Zombie process(From OS)

2. In decimal 184 which is equal to 1234 in x-ary format. Value of x is:
i. 3
ii. 4
iii. 5
iv. None of the above
Ans : iv

3. Find the complexity of the Equation: F(n)=F(n/2)+logn
i. logn
ii. loglogn
iii. log(n)^2
iv. (logn)^2

Ans i

4. You have 25 horses and you have to select fastest 3. You can make a race of 3 horses in one time. So how many time you have to make a race?
i. 6,
ii. 7
iii. 8
iv. 9
Ans ii

5. 4. You have 9 horses and you have to select fastest 3. You can make a race of 3 horses in one time. So how many time you have to make a race?
i. 3,
ii. 5
iii. 6
iv. 7
Ans ii

6. An AVL tree with height d. How many children it have?


7. 2^x=x^2 How many real roots are there?

8. In a ternary Tree No of leaves 28. How many nodes it have?

9. In tank with two pipes, filled within 24hrs and 16hrs and another pipe which empties it within 12hrs. If 3 pipes are opened together and what the time it requires to fill an empty thrice volumes Tank.
Ans: 144hours

10. In n-ary tree, how many leaves are there?

11. one man first go 1mile in east,1/2 mile in north, 1/4 mile in west, 1/8 mile in south, 1/16 mile in east and so on.. Now distance between destination and origin(0,0)?

12. How many 3-digit numbers are there whose sum is 13?

13. C program:
int x=150
for(y=x;y>0;y=(x&(y-1))
printf(Hi, There");
How many times how will be printed?
i. 0
ii. 1
iii. 75
iv. 150
ans: 150(not sure)

14. Get the output of the C program
int i=5;
printf("%u",&i);
What it will print:
i. 5
ii. Base address of the memory
iii. Physical address
iv. Logical address



15. A B C D ....Z
AA AB AC ....AZ
BA BB BC ....BZ
..
..
AAA AAB ... AAZ
Find the 1000th term of the sequence?




Directi Coding Question In IIT Guwahati 2010::::

In an n*n chess board you are given a position of a Knight(K) and the target position it has to reach(T). There are certain cells marked as X which the knight should not touched.
Find the least number of steps required for Knight to reach T from K.

Input:

First line  n.
Second line K in x space y format
Third line T in x space y format
Until you encounter -1 space -1, each line will have x space y format numbers indicating the locations of X.
(X and Y will be 1 based)

Output:
Integer value
(-1 if the knight cant reach T)


Example 1:

 Input:
3
11
22
33
32
-1-1
output:
-1

Example 2:

  Input:
4
11
23
-1-1
Output:
1



Directi Placement Paper 2011 NSIT
1. What is the big-O time complexity of func(p)?
 C++ code follows.
int get_power(int a, int b)
{
if(!b) return 1;
if(b%2) return a * get_power(a, b/2);
return get_power(a, b/2);
}
int func(int p)
{
int sum = 0;
for(int i = 1; i <= p; ++i) {
sum += get_power(i, 5);
}
return sum;
}
a. O(p log5)
b. O(plogp)
c. O(logp)
d. O(p)
e. O(p + logp)


2.Given a number N, generate a sequence S such that
S[ 0 ] = N
S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd,
= S[ i ] / 2, if S[ i ] is even,
till you reach 1.
For example for N = 5, the sequence is 5, 8, 4, 2, 1
Given two numbers 20 and 35, generate the sequence S for A
and B, and find the number where the two sequences meet.
a.20
b.30
c.35
d.40

3.Question 6: Multiple Answer
If at least two of the statements below
are false, what is the probability that
statement 2 is true?
1. A is true.
2. B is true.
3. A is false and B is true.
a.0
b.0.25
c.0.5
d.0.75
e.1

4.What is the value of p, in main()? C code follows.
char* rev(char s[ ])
{
for(int i = 0, n = strlen(s); s[ i ]; ++i)
{
char c = s[ i ];
s[ i ] = s[ n-1-i ], s[ i ] = c;
}
return s;
}
int main()
{
char s[ ] = "uncommon ideas!";
char *p = rev(s);
}
a. !saedi nommocnu
b. ideas! uncommon
c. uncommon ideas!
d. nommocnu !saedi

5.Given 4 processes with their entering
time and execution time as follows :
Process
Name
Entering
Time
Execution
Time
P1 2 10
P2 3 8
P3 6 4
P4 10 6
A CPU following the shortest job first
algorithm(preemptive) is going to execute
them.
A shortest job first algorithm will execute
a process with the smallest CPU burst
first, because it is preemptive, If a
process is in excution and another
process comes in with CPU burst being
smaller than the remaining execution
time of the currently executing process,
then the new process will be alloted the
CPU and the process currently executing
will be sent to the waiting queue.
For the given processes above Calculate
the average waiting time.
a. 7.25
b. 6.75
c. 5.25
d. 6.25
e. None of the above

6. Given below is the post-order traversal of
a binary search tree. Which of the
following is its pre-order traversal?
(6, 5, 12, 13, 11, 15, 14, 20, 16, 10)
a. 10, 5, 6, 16, 14, 11, 13, 12, 15, 20
b. 10, 5, 6, 15, 14, 13, 11, 12, 16, 20
c. 10, 5, 6, 14, 13, 11, 12, 16, 15, 20
d. 10, 5, 6, 16, 13, 11, 12, 14, 15, 20


7. Insert the numbers in the sequence "8, 5, 1, 4, 2, 10, 12, 7, 3" into a min-heap. The order of insertion is as given. The insertion happens as described here.
If the root is said to be at level 1, the root's children at level 2, and so on, what is the level in which 8 occurs in the heap?
·         a. 1
·         b. 2
·         c. 3
·         d. 4
·         e. 5
8.
You are given a wall that is 50m wide and a rope that is 20m in length. Place the two ends of the rope on the wall and form a figure such that the enclosed area between the wall and the rope is maximized. What is this area?
·         a. 63.63
·         b. 127
·         c. 50
·         d. 127.26
·    
9. Two players are playing a game on a checker board (see image below). There is a queen at (i,j) and it can only move such that either "i" or "j" or both decrease (by any amount), that is, it can move only left, or down, or diagonally left-down. The players take turns moving the queen, and the player who first reaches origin wins. Which (i,j) values will result in a win for the first player, among the following? Assume that both players play optimally.
You cannot leave the board.
Optimal Play: A player is said to make an "optimal move" if he has considered all his moves, and all the opponent's and his subsequent moves till one of them wins. An optimal player chooses his current move assuming that the opponent will force him into a losing position, if he can.
Example: If the queen is initially at (2,1), your possible moves are to (1,1), (0,1), (2,0) or (1,0). Every one of these moves will make the opponent make his next move to (0,0) and hence (2,1) is a losing position for the first player.
The following image shows a checker board with the cell (2,3) marked in red.

  a. 4,5
·         b. 5,3
·         c. 2,3
·         d. 3,4
·         e. 3,5

goldman sachs paper pattern and questions 2012


Rounds:

1. Aptitude 25 questions : really Tough one Time: 25 min

i. You have 4218 no of balls. put 1 balls at top layer 3 at 2nd top layer then 6 and then 10 ... Continue in this way. How many layers are possible.?

ii. A B and C have chance of failure of 20%, 30% and 40%. To activate the machine at least two should be active. What is the probability that machine will be active?

iii. One circle two radius are perpendicular. Their connecting end of length 7root2. What is the area of that circle?

iv. Two mixture A and B mix in ratio 5:1. the price of each is 2:5. The labor takes .25 for producing per Kg. The rate per kg is 16.50. What is the price of B?

v. Two pipes P and Q fills a tank in 30 and 60 min. a person starts that at 5am to fill. he comes when it may fill but he saw that pipe R was also opened which empties that tank. Then he closes R. Now 20 min takes to fill the tank. What time R takes to empty the tank?

vi. A B and C are going for a party. A have 5 breads and B have 3 breads. But they ate same amount of bread. Then what amount C will pay to B?

vii. In a clock between 11 and 12, how many time two sticks will meet in integer no places?

2. C and C++ : 10 question Time: 10 min only


i. One b+ tree of order 3. insert 10 8 6 4 3 2 1 will require how many time to break the leaves maximum?

ii. Show the output:
mul(int b)
{
return(b*2);
}
main()
{
a=4;
a=mul(a=mul(a=mul(4)));
printf("\n %d",a)'
}

iii. one question from Normalization from database..

iv. one question from inheritance in C++. to show output. Parent child relations like that.

v. One task to complete take 50ms by single processor. But in pipeline processor will take 10 ms. What is the speed up for the processor when doing 240 ms sized tasks?

vi. Show the output:
main()
{
*str="C:\tc\bin\random"
prtintf("\n %s",str);
}


3. Algorithm writing Time: 25min


i. WAP to find out the day where you have given a date day/month/year format. You consider the date 1/1/2001 as Saturday as base.

ii. WAP to reverse words of a sentence. Like "August first is the Sunday" Will be shown as "Sunday the is first August"


4. Writing Essay Time: 5min

Topic: If you meet with CEO of goldman Sachs in an Elevator what what conversation will make good impression on You. 1 min conversation only



One thing must to say... Time is very less and don't waste time on only one problem others may be easy....