Placement Papers - Microsoft

Why Microsoft Placement Papers?

Learn and practice the placement papers of Microsoft and find out how much you score before you appear for your next interview and written test.

Where can I get Microsoft Placement Papers with Answers?

IndiaBIX provides you lots of fully solved Microsoft Placement Papers with answers. You can easily solve all kind of placement test papers by practicing the exercises given below.

How to solve Microsoft Placement Papers?

You can easily solve all kind of questions by practicing the following exercises.

MICROSOFT PLACEMENT PAPER (TECHNICAL-C, OS)

Posted By : Abhishek Pandey Rating : +7, -3

PAPER: MICROSOFT PLACEMENT PAPER (TECHNICAL-C, OS)

1. An array of size k contains integers between 1 and n. You are given an additional scratch array of size n. Compress the original array by removing duplicates in it. What if k << n?
 
ANS. Can be done in O(k) time i.e. without initializing the auxiliary array!
 
2. An array of integers. The sum of the array is known not to overflow an integer. Compute the sum. What if we know that integers are in 2's complement form?
 
ANS. If numbers are in 2's complement, an ordinary looking loop like for(i=total=0;i< n;total+=array[i++]); will do. No need to check for overflows!
 
3. An array of characters. Reverse the order of words in it.
 
ANS. Write a routine to reverse a character array. Now call it for the given array and for each word in it.
 
 4. An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm?
 
ANS. "Expected time" should ring a bell. To compute a random permutation, use the standard algorithm of scanning array from n downto 1, swapping i-th element with a uniformly random element <= i-th. To compute a uniformly random integer between 1 and k (k < n), call rand_n() repeatedly until it returns a value in the desired range.
 
5. An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings.
 
ANS. Scan array in pairs. Remember largest-so-far and smallest-so-far. Compare the larger of the two strings in the current pair with largest-so-far to update it. And the smaller of the current pair with the smallest-so-far to update it. For a total of <= 3n/2 strcmp() calls. That's also the lower bound.
 
6. Write a program to remove duplicates from a sorted array.
 
ANS. int remove_duplicates(int * p, int size)
{
int current, insert = 1;
for (current=1; current < size; current++)
if (p[current] != p[insert-1])
{
p[insert] = p[current];
current++;
insert++;
} else
current++;
 
return insert;
 
}
 
7. C++ ( what is virtual function ? what happens if an error occurs in constructor or destructor. Discussion on error handling, templates, unique features of C++. What is different in C++, ( compare with unix).
 
8. Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list).
 
9. Given 3 lines of assembly code : find it is doing. IT was to find absolute value.
 
10. If you are on a boat and you throw out a suitcase, Will the level of water increase.
 
11. Print an integer using only putchar. Try doing it without using extra storage.
 
12. Write C code for (a) deleting an element from a linked list (b) traversing a linked list
 
13. What are various problems unique to distributed databases
 
14. Declare a void pointer ANS. void *ptr;

15. Make the pointer aligned to a 4 byte boundary in a efficient manner ANS. Assign the pointer to a long number and the number with 11...1100 add 4 to the number
 
16. What is a far pointer (in DOS)
 
17. What is a balanced tree
 
18. Given a linked list with the following property node2 is left child of node1, if node2 < node1 else, it is the right child.
 
O P
 
|
 
|
 
O A
 
|
 
|
 
O B
 
|
 
|
 
O C
 
How do you convert the above linked list to the form without disturbing the property. Write C code for that.
 
O P
 
|
 
|
 
O B
 
/
 
/
 
/
 
O ? O ?
 
determine where do A and C go
 
19. Describe the file system layout in the UNIX OS
 
ANS. describe boot block, super block, inodes and data layout
 
20. In UNIX, are the files allocated contiguous blocks of data
 
ANS. no, they might be fragmented
 
21.How is the fragmented data kept track of  Describe the direct blocks and indirect blocks in UNIX file system
 
22. Write an efficient C code for 'tr' program. 'tr' has two command line arguments. They both are strings of same length. tr reads an input file, replaces each character in the first string with the corresponding character in the second string. eg. 'tr abc xyz' replaces all 'a's by 'x's, 'b's by 'y's and so on. ANS.
a) have an array of length 26.
put 'x' in array element corr to 'a'
put 'y' in array element corr to 'b'
put 'z' in array element corr to 'c'
put 'd' in array element corr to 'd'
put 'e' in array element corr to 'e'
and so on.
 
the code
while (!eof)
{
c = getc();
putc(array[c - 'a']);
}
 
23. what is disk interleaving
 
24. why is disk interleaving adopted

25. given a new disk, how do you determine which interleaving is the best a) give 1000 read operations with each kind of interleaving determine the best interleaving from the statistics
 
26. draw the graph with performance on one axis and 'n' on another, where 'n' in the 'n' in n-way disk interleaving. (a tricky question, should be answered carefully

Like this page? +7 -3




Companies List:

3i Infotech - AAI - ABACUS - ABB - Accel Frontline - Accenture - Aditi - Adobe - ADP - Agreeya - Akamai - Alcatel Lucent - Allfon - Alumnus - Amazon - Amdocs - AMI - Andhra Bank - AppLabs - Apps Associates - Aricent - Ashok Leyland - Aspire - Atos Origin - Axes - Bajaj - Bank of Maharashtra - BEL - BEML - BHEL - BirlaSoft - Blue Dart - Blue Star - BOB - BPCL - BPL - Brakes - BSNL - C-DOT - Cadence - Calsoft - Canara Bank - Canarys - Capgemini - Caritor - Caterpillar - CDAC - CGI - Changepond - Ciena - Cisco - Citicorp - CMC - Consagous - Convergys - CORDYS - Crompton - CSC - CTS - Cummins - Dell - Deloitte - Delphi-TVS - DeShaw - Deutsche - Dotcom - DRDO - EDS - EIL - ELGI - ELICO - ERICSSON - Essar - Fidelity - Flextronics - Freescale - FXLabs - GAIL - GE - Genpact - Geodesic - Geometric - Globaledge - GlobalLogic - Godrej - Google - Grapecity - HAL - HCL - Hexaware - Honeywell - HP - HPCL - HSBC - Huawei - Hughes - IBM - IBS - ICICI - iGate - Impetus - iNautix - Indian Airforce - Indian Airlines - Infosys - Infotech - Intec - Integra - Intergraph - IOCL - iSOFT - ISRO - Ittiam - JSW - Keane - Kenexa - L & T - L & T Infotech - LG Soft - Lifetree - LionBridge - Mahindra Satyam - Mastek - Maveric - McAfee - MECON - Microsoft - MindTree - Miraclesoft - Mistral - Motorola - Mphasis - MTNL - NIC - Nokia Siemens - Novell - NTPC - Nucleus - ORACLE - Patni - Perot - Polaris - Ramco - Robert Bosch - Samsung - SAP - Sapient - Sasken - SBI - Sierra Atlantic - Sonata - Sony India - Sutherland - Syntel - TCS - Tech Mahindra - VeriFone - Virtusa - Wipro - Zensar.