Contact Details:

Mail : amarnath255561@gmail.com

Sunday, December 22, 2013

Microsoft Written Paper 2013


Type : Online

Platform : Cocubes

Tip : MCQ bits will be repeated mostly from previous year papers or get the questions from the other IIT's who had completed their written exam.

2 Rounds:
1st Round : 15 MCQ      After this Shortlisting will be done for Round 2

Selection criteria(for us) : have to attempt at least 10 Questions correct out of 15.

2nd Round : 2 Coding Questions  1 Hour

Questions may differ from person to person

Collection of all bits from all IIT's :

1. 48 bit architecture, what is size of virtual address space?

2. 1 rabbit couple. Couple will start producing other couple only when their age is one month.Initially in first month one couple is there. how many couples will be at the end of year.
Hint Fibonacci series 233

3. Some cpp codes. and asked output. (i.e. Virtual Functions)

4. C codes and output.

5. Find bugs in given code.

6. Complexity of BFS if adjacency list is given.

7. What is used in Demand paging
a) sequential search b) binary search …

8. If pointer to function is declared the how to call that function.

9. If we add a constant weight to each edge in a graph will the shortest path “between any two vertices” change ?
Ans: (May or may not change) //*this will be Depends, not NO, consider a graph whose one path from A to B has 4 edges of 1 and other path with 2 and 3, now add 1 to all edges..now shortest path becomes 2 and 3*

10. how many '0' in 100! ? ans: 24 (100/5+20/5+⅘)

11. For recursive Fibonacci , what is its complexity ? ans : O(2 pow n)

12. i=2, printf("%d%d",++i,++i) ans: 4 4 /*sequence point concept in C comes into picture here*/ (depends on the compiler ??) ( it depends on the compiler, giving 4 3 here (where?))

13. int c[]={2,3,4,5,6},
int *p=c, int *q=c,
(1)for(i=1 to 5){printf("%d",*c); q++}
(2)for(i=1 to 5){printf("%d",*p); p++}
ans : 2222223456(it should be continuous because no \n is there.)
Many questions were of the kind : give the output of following C/C++ code

14. x=4|3<<4 ; x= ? ans : 52

15. x= 2, y= 4, z=10 ; if (x<y<z) {printf("abc")} else {printf("pqr")} ? ans : abc

16. x=1; mask = ~(x<<5 1) What is
(1) mask & 48
(2) mask & 64
(3) mask & 121
ans: 32 64 105

17. In an page fault system implementation , what is “good” way to access pages ? and
(1) Linear search
(2) Arithmetic indirection
(3) Binary search .
(4) Vector Operation
Correct Ans: Option(
4)and (1)..it was a multiple correct type………

18. which of the foll gives most efficient way to access elements sequentially?
(1) LL (2) DLL (3) vectors

19. what is the output ?
class A{
public: void foo(){
printf("a");
}
};
class B : public A { public: void foo(){printf("b")}};
class C : public B { public: void foo(){printf("c")}};
void foo(B &b){
b.foo();
}
main(){
C c;
foo(c);
}
output :b

20. What is the data structure that has O(log n)complexity on averaging for the operations:
search, insert, delete.

21. Find the output:
#include<stdio.h>
int fun(int num) {
while(num > 0) {
num=num*fun(num1)
;
}
return num;
}
void main() {
x = fun(8);
printf(“%d”,x);
}
ans: 0

22. Find the output: int fun(int num)
{ if(num<3)
return 3;
return num+fun(num2);
}
main()
{
int x=fun(12);
int y=fun(13);
printf(“%d %d”,x,y);
}
43 51

23.
code 1:
 int MAX=1000;
int a[MAX][MAX];
for(i=0;i<MAX;i++)
for(j=0;j<MAX;j++)
a[j]=i*j;

code 2:
int MAX=1000;
int a[MAX][MAX];
for(i=0;i<MAX;i++)
for(j=0;j<MAX;j++)
a[i]=i*j;
Which is correct?
a. code 1 is faster
b. code 2 is faster
c. both are same in RISC architecture
d. both are about same

24. class A
{
public: A(){cout <<”AC ”;}
~A(){cout <<”AD “;}
};
class B: public A
{
public: B(){ cout<<”BC “;}
~B(){cout <<”BD “;}
};
main()
{
B *b1 = new B(); B b2;
}
Ans: AC BC AC BC BD AD

25. int fun(int num)
{
if(num < 3) return 3;
return num + fun(num2);
}
main()
{
printf(“%d %d\n”, fun(12), fun(13));
}
Ans: 43,51

26.int n = 1000, c = 5;
do{n/=c;}while(c)
;
printf(“%d”, n);
Ans: Arithmetic error (divide by 0)

27.unsigned int a=1;
unsigned int b=~1;
int z=a*b;
printf(“%d”,z);
Ans: 2



Round 2 :

IITB Coding Questions :

1. Given a 2D matrix. Each cell was filled with a specific color denoted by single character eg.
for blue ‘
B’. If one position is clicked (x,y), colour present at that position would be deleted. If
the same colour is present in neighbourhood (up/down/left/right) then it would also be deleted.
After deletion blank spaces will be replaced by the value present in the cell above that. In case
no value present above the cell then blank entry will be replaced by 0.
Input
x:1 y:1
BGB
BGG
BBB

Output
B00
B0B
BBB

2. Given a linkedlist
swap the alternative nodes (assume list have even number of nodes.)

Input : 11->12->13->14
Output : 12->11->14->13

For IITB guys because of cocubes platform Problem, they have got the Re-Test again

1) check is two words are anagrams.
2) Delete every nth node in a linkedlist.
     Let the LL be, 1->2->3->4->5 and n = 2,
     then resultant list will be: 1->3->5

IIT D, IIT R,IIT Kgp Coding Questions :

1. prune all the nodes from a BST which are not in the range minValue and maxValue
2. print last 10 lines of a very large string

IIT G Coding Questions :
Q.1. In a TicTacToi game two players are playing where player 0 is denoted as 0 and player 1 is denoted
        as 1.Given a linked list of moves made by the players determine who is the winner and in how many moves he required for winning.(You have to just print )…
Struct Move{
int p; //Player number
int x; //x and y pos in the tictactoi
int y;
struct Move *next;
};
The sample function to write is:
void playGame(struct Move *move, int N)

Q.2.Given an array if in a position let a[i][j] =1 then print all it’s row and column 1. You should not
consider a position 1 after you made it 1 in your past computation.
sample(input):
(i)00100 (ii)10
   00000      01
output:
(i)11111 (ii)11
   00100     11





No comments:

Post a Comment