Microsoft Interview Questions
- 3of 3 votes
AnswersGiven pointer to the bytes array on size N that represents big integer "a" and 2-bytes integer "b" implement mod (%) operation for them: a % b
- russ.kovich December 14, 2012 in United States for Bing| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Bit Manipulation - 0of 0 votes
AnswersLet's say you have to make changes to 1000 API's. For example, currently developers need to put a .then() just to write something to the screen; we want to remove this in simple cases, but also enable it in cases where you really do want to write something only AFTER some other action has taken place.
- panoptic.biopower December 12, 2012 in United States for Windows
These 1000 API's are split among 200 teams, and you're a product manager for one of those teams.
How do you go about pushing for this change, so that eventually all of them will be changed?
How long would it take? What is the deadline?
What if one team simply says they're far too busy?
And once the dev teams are done with the changes, what more is there to do? What should the testing team do?| Report Duplicate | Flag | PURGE
Microsoft Intern - 1of 1 vote
AnswersDesign algo for insertElement, deleteElement and getRandomElement, expected complexity for all the operations will be less than O(n).
- Andi December 12, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 2of 2 votes
AnswersI have one bag of bolts and another bag of nuts, need to find biggest Bolt. Condition is must not compare both bolts or both nuts. only comparison between bolt and nut allowed.
- Andi December 12, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 1of 1 vote
AnswersGiven the string of parentheses only, write the function to check if they are balanced. ((())) is balanced, )( is not.
- Evan December 12, 2012 in United States
Follow up: Now the string also contains curly and square braces. You already have boolean functions, isOpenBrace() , isCloseBrace() and bracesMatch(char brace1, char brace2) as required. How do you check if braces are balanced?| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersTree with black and white nodes is given. Find a longest path of white nodes in the given tree.
- cynic.vader December 10, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Trees and Graphs - 0of 0 votes
AnswersImplement your own API and library for a synchronization OS problem.Write your own semaphore.
- atanu1991 December 10, 2012 in India
Eg: Capacity of TAM is 5 .. Queue of people outside is 100. Synchronization reqd.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Operating System - -1of 1 vote
AnswersImplement queue using stacks.
- atanu1991 December 10, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersDelete the nth last element from a singly linked list. Don't count number of nodes initially.
- atanu1991 December 10, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 2 votes
AnswersImplement a bus reservation system asume bus' seats are as follows
- rachitrocks2k December 10, 2012 in India for Bing
HHHHHH
HHHHHH
HHHHHH
. . . . . . . .
you can assume 10 rows in bus.
Now if user enters 4 as required seat no then the prefrence order would be
4
3,1
2,2
2,1,1
1,1,1,1
and the function should return the seat number.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Data Structures - 2of 2 votes
AnswersGiven An Array with N integer with values ranging from 1 to N. there is only one duplicate in the Array.
- Geek December 09, 2012 in United States
Find out Duplicate value.
i.e.
A = { 10,6,3,4,7,5,2,4,9,1}
values from 1 to 10.
in this example, Duplicate element is 4.
N could be quite large.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersA pxq size matrix is given, and a matrix of size axb is removed from top right corner. Find the total no. of paths from top left to bottom right, with only right and down movements allowed. No path should go into the removed matrix.
- LAP December 06, 2012 in India
eg-
_
|_|_
|_|_|
this is (2x2) matrix after removing (1x1) matrix from top right corner. no. of ways - 5.
The algorithm should be fast enough.| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 3of 5 votes
AnswersGiven two singly linked list, find if they are intersecting. Do this in single iteration. Also find the intersecting node in O(n) time and O(1) space. By intersection I mean intersection by reference not by value
- dm December 05, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWrite a function that takes an array as an input and returns starting and ending indexes
- heuristican December 03, 2012
within the array such that if we add elements from the starting and ending index we would get
maximum possible sum of any contiguous set of elements within that array.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 1of 1 vote
AnswersGiven a satellite picture with islands in ocean, how would you count the number of islands?
- amit.8561 November 30, 2012 in India for Bing| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou have a log file with start/end times of different functions.
- goRGon November 26, 2012 in United States for Bing
Find the total exclusive working time for a particular method foo().
E.g. Log:
(foo()_start, 10:01);
(foo2()_start, 10:03);
(foo()_start, 10:05);
(foo()_end, 10:08);
(foo2()_end, 10:12);
(foo()_end, 10:20);
Total time: (10:03-10:01) + (10:08-10:05) + (10:20-10:12) = 2 + 3 + 8 = 13
P.S. Recursion calls and inner calls of foo() are possible| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
Answerswrite a function to check given string matches with given pattern
- Andi November 24, 2012 in India
Condition: only one wildcard used in the pattern, that is '*', but can be used in the pattern more than once.
Example:
pattern: *abc*def*.doc*
str: adsfabcxyzdefgh.docx
fucntion signature is like: boolean isMatching(String str, String pattern);| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersGiven an array of positive and distinct integers, output all pythogrean triplets of them i.e They have to satisfy: a.a + b.b = c.c
- nishanth2 November 22, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an integer array, convert it into a linked list with each node containing one sequence.
- manish.89july November 15, 2012 in India
Please reply on manish.89july@gmail.com| Report Duplicate | Flag | PURGE
Microsoft Applications Developer Coding - 0of 0 votes
AnswersGiven an integer array with sequence of numbers, come up with a way to compress the data without losing the information. Based on the compressed data, it should be possible to construct the original integer array.
- manish.89july November 15, 2012 in India
Please reply on manish.89july@gmail.com| Report Duplicate | Flag | PURGE
Microsoft Applications Developer Coding - 0of 0 votes
AnswersGiven an integer array, find the longest sequence and print it.
- manish.89july November 15, 2012 in India
Please reply on manish.89july@gmail.com| Report Duplicate | Flag | PURGE
Microsoft Applications Developer Coding - 0of 0 votes
AnswersFind the number of sequences in an integer array. A sequence is a list of numbers(more than one number) that comes in strict numerical order like [3, 4, 5, 6].
- manish.89july November 15, 2012 in India
Please reply on manish.89july@gmail.com| Report Duplicate | Flag | PURGE
Microsoft Applications Developer Coding - 0of 0 votes
AnswersTest cases for finger print reader say in a laptop to login. Here you can swipe your finger to have a secured login. e.g. I will swipe my finger and the system will allow me to login.
- arun November 12, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer - 0of 0 votes
AnswersGiven an integer array, sort the integer array such that the concatenated integer of the result array is max. e.g. [4, 94, 9, 14, 1] will be sorted to [9,94,4,14,1] where the result integer is 9944141
- siva November 11, 2012 in United States for WF
Can we solve this in less than n square time?
n square algo is here
private bool isSwapNeeded(int i, int j)
{
int isum = i * (int)Math.Pow(10, NumberOfDigits(j)) + j;
int jsum = j * (int)Math.Pow(10, NumberOfDigits(i)) + i;
return isum > jsum;
}
private int NumberOfDigits(int i)
{
int noOfDigits = 0;
if (i == 0)
return 1;
while (i>0)
{
noOfDigits++;
i /= 10;
}
return noOfDigits;
}
public int[] MaximumConcatArray(int[] input)
{
int j;
for (int i = 1; i < input.Length; i++)
{
j = i;
while (j>=1 && isSwapNeeded(input[j],input[j-1]))
{
input[j] = input[j] ^ input[j - 1];
input[j-1] = input[j] ^ input[j - 1];
input[j] = input[j] ^ input[j - 1];
j--;
}
}
return input;
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - -1of 1 vote
Answerswrite the test cases for the Swiping Pad ....??
- arun November 11, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer - 0of 0 votes
AnswersWrite positive test cases to test this function
- siva November 09, 2012 in India for Bing
bool FileCopy(string source, string destination)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersWrite code using commands below for two rovers to meet. Two rovers are dropped on Mars. Imagine Mars to be a straight infinite plane. When the rovers are dropped on Mars they are dropped with parachute. So their initial position on Mars is on parachute.
- Dee November 01, 2012 in United States
Only commands possible to execute:
1. Go left
2. go right
3. NO OPERATION
3. If on parachute go to lablel.
Label can be a piece of code with a name where we can transfer execution
Using ONLY commands above write code for rovers to meet.| Report Duplicate | Flag | PURGE
Microsoft - 2of 2 votes
AnswersGiven an array, find all maximal sub-arrays in which all pairs have their sum greater than k. DP would give us a O(n^2) algorithm. Can we do better.
- Vikas October 29, 2012 in United States
suppose k = 4
-4 9 10 4 -3 8 9 -2
Answer is:
-4 9 10
9 10 4
-3 8 9
8 9 -2| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersInput:
- coder_aspirant October 26, 2012 in United States
Given a hexadecimal value:
int i=0x3b24
Output: 0x243b
Some other case:
input: 0x123456
output:0x456123| Report Duplicate | Flag | PURGE
C Microsoft - 0of 0 votes
AnswersWrite a program to swap odd and even bits of a 32-bit unsigned integer with as few instructions as possible. (bit-0 and bit-1 are swapped, bit-2 and bit-3 are swapped and so on)
- @ce October 24, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Intern Bit Manipulation