Microsoft Interview Questions
- 0of 0 votes
AnswersRemove duplicates in an array of numbers. You can use a second array or the same array, as the output array. (I used a hash table to do this).
- sush February 27, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Hash Table - 1of 5 votes
AnswersYou have 9 balls. 8 of them weigh the same, but one of them weighs heavier than the other 8.
- SK February 26, 2015 in United States
How can we find the heaviest weighted ball in no more than 2 operations?| Report Duplicate | Flag | PURGE
Microsoft Brain Teasers - 1of 1 vote
AnswersA 2-D array of 1's and 0's is given. Find the row with max 1's. The array is sorted row wise (all 0's in a row are followed by all 1's).
- Guest February 12, 2015 in India| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersGiven an array with 10000 numbers from the range 1-10. WAP to sort them.
- Guest February 12, 2015 in India| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersDescribe in terms of computer architecture, how would you optimize running a search on a large database? Assume a PC with regular specs and database size of several terabytes.
- shane February 09, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Intern - 1of 1 vote
AnswersWrite a function that does an in-order traversal of a tree and prints out the contents (Assume each node has 1 piece of content which is an integer).
- americano- January 24, 2015 in United States for Cloud
Write this function without using recursion (you can assume a library that has stack/queue/list objects with some standard methods is available for use by you).
What is the maximum size your stack can grow to and what is the expected size that your data structure can grow to assuming that the tree has n nodes?| Report Duplicate | Flag | PURGE
Microsoft SDET Data Structures - 0of 0 votes
AnswersFind and fix the bugs in the following function that is supposed to remove the head element from a singly linked list.
- americano- January 24, 2015 in United States for Cloudvoid RemoveHead (node * head) { free(head); head = head - > next; }
| Report Duplicate | Flag | PURGE
Microsoft SDET Debugging - 0of 0 votes
AnswersWrite a function that takes a string as an input and outputs an integer, e.g. turning "1234" into 1234.
- americano- January 24, 2015 in United States for Cloud| Report Duplicate | Flag | PURGE
Microsoft SDET Coding - 0of 0 votes
AnswersDesign your own String Pooling system. It should return a String with request of more length. String pool should have strings of different sizes available. When requested, it should just be returned to client and when client is done using string, it should be added back to string pool for other client to use.
- msgsmg January 23, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswersGiven a string, write a function to determine whether it is a valid IP address or not. Regex solutions are acceptable, but what other ways can it be done?
- SK January 23, 2015 in United States
boolean isValidIP(String s) {
//code here
}| Report Duplicate | Flag | PURGE
Microsoft - 1of 1 vote
AnswersA Matrix of 1s and 0s is given, all zeros are water and 1s are land, first find out the number of ponds in the array (Reverse of islands problem). If one change can convert 1s in to zero then find out minimum number of changes that we need to make so that there will be only one pond in matrix..
- manidam07 December 16, 2014 in India for ICE
Any algo how to make 1 pond ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 1of 1 vote
AnswersYou have a chess board of size NxN. You have a horse at a given starting position. You also have a function that gives you all the positions that the horse can reach from it's current position.
- Ray December 12, 2014
Given an ending position, find the path to it that uses the minimum number of moves.| Report Duplicate | Flag | PURGE
Microsoft SDE1 Algorithm - 1of 1 vote
AnswersGiven an array of integers when the difference between every two neighbored elements is either -1 or +1 or 0.
- maya November 24, 2014 in United States
Write an efficient search algorithm to find a given number of x in the array.| Report Duplicate | Flag | PURGE
Microsoft Intern - 0of 0 votes
AnswersGiven two string you need to tell whether edit distance between two string is 1 or not.
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersTwo sorted array of integer are given, you need to find nth rank element from combine array.
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersThere is a set of n bolts and n nuts given. You have only API that tells whether given nut is smaller or larger then for a bolt no any other relative number. You need to match all nuts and bolts in O(nlogn).
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - -3of 3 votes
AnswersGiven an sorted array having duplicates and another which is not sorted and have duplicates.Find array b is found continuously in array a. if so print position of array b in array a
- anooha.kandukuri November 14, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Development Support Engineer Algorithm - 0of 0 votes
AnswersHow would test this method ?
- naveenraman.a November 12, 2014 in United States
public static bool DateBetweenDates(DateTime startDate, DateTime endDate, DateTime dateToTest)
{
if (startDate.Year > dateToTest.Year)
return false;
if (endDate.Year < dateToTest.Year)
return false;
if (startDate.Month > dateToTest.Month)
return false;
if (endDate.Month < dateToTest.Month)
return false;
if (startDate.Day > dateToTest.Day)
return false;
if (endDate.Day < dateToTest.Day)
return false;
else
return true;
}| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Testing - 0of 0 votes
AnswersIn a matrix of characters, find an string. String can be in any way (all 8 neighbors to be considered), like find Microsoft in below matrix.
- varsrm November 01, 2014 in United States
A-C-P-R-C
X-S-O-P-C
V-O-V-N-I
W-G-F-M-N
Q-A-T-I-T
String Microsoft is present in the matrix above ?
There also a slight variation where a diagonal neighbor is not considered.| Report Duplicate | Flag | PURGE
Microsoft Software Development Manager - 1of 1 vote
AnswersGiven n rows of integers, such that the ith row (1 <= i <= n) contains i integers, find the path having the maximum weight.
- ramdomain October 29, 2014 in India
Path traversal rules:
1. A valid path sequence would be top-down i.e. begins with the integer in the first row, and traverses all rows selecting only one integer in each row.
2. From any jth integer in the ith row i.e row[i][j], traversal can happen either downward (i.e to row[i+1][j]) or diagonally downward to the right (i.e to row[i+1][j+1])
The weight of a Path is the sum of values of integers in the Path sequence.
Sample Input:
No. of Rows: 5
4
2 9
15 1 3
16 92 41 44
8 142 6 4 8
Expected Output: 4, 2, 15, 92, 142 (Max weight is 255)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersJava: You're given a very large array of char's. Write a method to remove duplicates in the array, in place. Optimize for space complexity, not time complexity.
- davelee71047 October 24, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern Arrays - 0of 0 votes
AnswersSay you're the development lead for a mobile application. A user submits a bug report saying that something isn't working right even though internal tests show that it should. What do you do?
- davelee71047 October 24, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern Application / UI Design - 0of 0 votes
Answerswrite a program to find the minimum value in an unsorted array of integers. how many assignment operations happen within the loop?
- determinedgal89 October 01, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 2of 2 votes
Answerswhat does this code do?
- determinedgal89 October 01, 2014 in United Statesunsigned mystery(unsigned x) { unsigned i=0; while(x) { x=x&(x-1); i++; } return i; }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Bit Manipulation - 0of 0 votes
Answerswrite a program to return min value from an unsorted array of integers. How many assignment operations happen within the loop?
- determinedgal89 October 01, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 0of 0 votes
AnswerYou are writing a simulation for a print server. This print
- determinedgal89 October 01, 2014 in United States
server can accept jobs from 3 places - network, USB, or operator. It can dispatch only one job at a time. Each input job should contain an integer t which is the time in seconds it will take to process the job. Write a multi-threaded program to simulate the server and provide some simulated load with jobs. Think, of some interesting statistics your program should emit and code them in.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Threads - 2of 2 votes
AnswersWrite a function which gives the length of the largest palindrome found within a string.
- grekogecko October 01, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - -2of 2 votes
AnswersWrite a function that detects if a string is a palindrome.
- grekogecko October 01, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 2 votes
AnswersDifference between a crash and exception.
- avinash September 20, 2014 in India for GTSC
Difference between macros and inline functions.
Mfc: message maps and virtual functions.
Different calling convention.
Late n early binding...
Garbage collector algorithm. When gc will fail to clean the memory.
How to know heap size, crash dump analysis, What is a stack n how to know stack memory size.
Commands in windbg.
Questions on Critical section, mutex, semaphores. Can we use mutex in single process and how?
Working of MSIL and JIT COMPILER.
Can a C# code, use c++ code and call kernel functions like createfile.
Areas: dot net, oops, operating systems, thread synchronization.
Difference in execution steps of c++ and c# code| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Assembly C++ Data Structures Debugging Object Oriented Design Operating System Threads - 1of 1 vote
AnswersGiven a graph where every two nodes are either friends or enemies with each other. Find a way to go from one node to the other.
- blackfever September 17, 2014 in India
Restrictions:
1) You can also travel from one node to next if they are friends with each other
2) You have some “magic potions”. You can convert an enemy path to a friend path with a magic potion.
I know this can be solved easily using dfs or bfs but i want to know the time complexity of each approach| Report Duplicate | Flag | PURGE
Microsoft SDE1 Algorithm