Microsoft Interview Questions
- 0of 0 votes
AnswersGiven 2 sorted linked lists - merge them. Make sure you don't have duplicates in the merged list. The input lists could have duplicates within them or across the 2 lists.
- ST April 18, 2011| Report Duplicate | Flag | PURGE
Microsoft Citrix System Inc Software Engineer / Developer Software Engineer in Test Algorithm Linked Lists - 0of 0 votes
AnswersGive atleast 10 test cases for a program which finds and eliminates the duplicates in a singly linked list. assume it has all positive integers and returns the head of the linked list without the duplicates
- WittyWoman March 25, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 0 votes
AnswersWhat is the data structure which suits best for the Battleship game? The board will be of size n x n, with m different ships each having k1, ..., km lengths. Each ship can either by place horizontally or vertically on the board.
- WittyWoman March 23, 2011
The structures should be designed such that they can support basic operations for playing a game. For example, the board and a particular (i, j) coordinate representing a position on the board may be passed into a function attack(). The function should return hit if a ship was hit at that position, sunk if a ship has sunk after being attacked at that position, and miss if no ship is at that position.
Describe your design of the structures, what kind of data they store, and the runtime complexity of typical operations for playing the game (like the attack() function) as a result of your design decisions| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersSelect a product and tell me what improvement you would make to the product.
- pritam83 March 09, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersPreparing sets from a given array with min complexity.
- Shiva February 26, 2011
S1=1,2,3,4,5
stes = {1},{2},{3},{4}..{1,2},{1,3}..{1,2,3,4,5}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersImplement Queue using Stack. Help to get a code with resolving complexity.
- Shiva February 26, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Data Structures - 0of 0 votes
AnswersThere are two string array with some uniqueue srings. Need to find out first arry uniqueue values in the 2nd array.
- Shiva February 22, 2011
S1={"Albert","Matt","Jackson","Steve","Ven"}
S2={"Kelos","Dragi","Matt","Ven","Possi"}
Answer={"Matt","Ven"}
Please provide us O(n) solution to the above.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersHy there are 4 questions asked in microsoft written paper in bangalore-
- ajitpec February 14, 2011
1) you are given a function prototype like
char * replace(char *str,char *find,char *replace)
you need to code it and specifications are-
str is input string .
find is a given pattern and you need to find this pattern and if it exist replace it with another string (replace).
for example-
if you are given input string "aabcdef" and find pattern is "bcd" and replace string is "xyz" then output string should be "aaxyzef".
Also if Input string is "aabcdef" and find pattern is "bcd" and replace string is "xxxx" the output should be "aaxxxxef".
2) Write top 10 Scenarios for above code and three most critical test cases for above code.
3) Write top test cases to test coffee vending machine.
4)There are 8 cricket teams say t1,t2,t3,..t8 and each team plays two matches against each team one match in india and one match in abroad.these matches are known as league matches. Now after league matches top 4 teams(top scorer) will enter semi finals.Some data is-
A) each win gives one point to winning team.
B) There is no draw in any match.
C) at any point if scores of any two teams are equal then winner is decided by an automatic machine and is out of your control.
Now find-
x) Minimum number of matches to win so that a team can qualify for Semi finals.
y) Maximum Number of matches won by a team when it canNOT qualify for semifinals.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersCode malloc() in C
- J February 10, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding - 0of 0 votes
AnswersIn my current company I am doing development. I got SDET Microsoft (IDC Hyderabad) offer.
- sss February 08, 2011
I am in conflict state, whether to accept SDET or not. One thing I can say, I am not interested in testing.
I think, if I enter into SDET role, I cannot come back to SDE role since other companies also offer SDET role ( after two years).
I inquired about role change from SDET to SDE in Microsoft and it is not possible ( or very rare).
After two years, if I want to change from Microsoft to new company, then every company will consider my profile for testing or SDET.
Do you know anything about role change from SDET to SDE ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test General Questions and Comments - 0of 0 votes
AnswersYou are given a 1D array of integers, such as:
- rashmi February 07, 2011
int[] array = [3,4,7,2,2,6,0,9];
Suppose you need to treat this array as a 2D table with a given number of rows.
You want to sum the columns of the table.
another value for numRows is 4..in that case the resultant array would look like
what if numRows==4?
3 4
7 2
2 6
0 9
----
12 21
write up a function as follows:
int[] retArray SumColumns(int[] array, int numRows)
{
}
try to come up with a linear solution- no constraints on space..
this was a phone int q i got, i gave a linear soln with some hints from the interviewer..biggest lesson learnt, before giving fancy test cases, check for THE MOST obvious case, null input..very very important, cant stress enough!..all the best for your interviews| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersPath to deepest 1 in a binary tree.
- shilpa February 02, 2011
We have a binary tree (not a BST) made up of only 0s and 1s. we need to find the deepest 1 with a path from root made up only of 1's.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersLook at the binary tree below and the corresponding matrix given.
- manu February 02, 2011
Now write an algorithm to generate matrix for any give binary tree
a
/ \
b c
/ \ / \
d e f g
|a|b|c|d|e|f|g|
a|0 0 0 0 0 0 0
b|1 0 0 0 0 0 0
c|1 0 0 0 0 0 0
d|1 1 0 0 0 0 0
e|1 1 0 0 0 0 0
f|1 0 1 0 0 0 0
g|1 0 1 0 0 0 0| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersFirst remove all repeated consecutive substring with length 1, then delete substring of length 2 and so on...
- manu February 01, 2011
Example : string is “abcabeccced”
After removing repeated substring of length 1: “abcababceccced” --> “abcababceced” (2 'c' are removed)
After removing repeated substring of length 2: “abcababceced” --> “abcabceced” (substring “ab” is removed)
and so on...
propose an algo for this...| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersGiven an array of +ve and -ve integers, re-arrange it so that u have +ves on one end and -ves on other,BUT RETAIN ORDER OF APPEARANCE..
- shilpa February 01, 2011
for eg,
1,7,-5,9,-12,15
ans=
-5,-12,1,7,9,15
do it in O(n) without using any extra space.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - -1of 1 vote
AnswersGiven an array of size n wherein elements keep on increasing monotically upto a certain location
- mitr February 01, 2011
after which they keep on decreasing monotically, then again keep on increasing, then decreasing
again and so on. Sort the array in place in O(n) and using only O(1) extra memory).| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersDifference is Minimum
- manu January 31, 2011
Algorithm to find the two numbers whose difference is minimum among the set of numbers.
For example the sequence is 5, 13, 7, 0, 10, 20, 1, 15, 4, 19
The algorithm should return min diff = 20-19 = 1.
Constraint - Time Complexity O(N) & Space is not a constraint [upto O(3N)]
Assumption - Sorting O(nlogn) & comparison of adjacent numbers is already known & is not an option. Try to keep it linear| Report Duplicate | Flag | PURGE
Microsoft Amazon Software Engineer / Developer Software Engineer in Test Algorithm - 0of 0 votes
AnswersFind bugs in the following program---
- ajitpec January 29, 2011
Function is accepting a string and length of string and it is supposed to return number of occurrences of 'A' or 'a' ..
unsigned int occur(char *pch,unsigned long len)
{
int tmpvar=len;
int i=0;
int ret=0;
if(*pch==NULL || !strcmp(pch," "))
return 0;
do
{
if(pch[i]=='A' || pch[i]=='a')
ret++;
else
i++;
}while(i<tmpvar);
return ret;
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersFind Bugs in the following function-
- ISL January 29, 2011
This function accepts a string and its length and it supposed to return number of A or a present in that string-
unsigned int occur(char *pch,unsigned long len)
{
int tmpvar=len;
int i=0;
int ret=0;
if(*pch==NULL || !strcmp(pch," "))
return 0;
do
{
if(pch[i]=='A' || pch[i]=='a')
ret++;
else
i++;
}while(i<tmpvar);
return ret;
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersGiven 2 strings S1 and S2, Check the first charaster that is repeated in S2.
- Anonymous January 17, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersGiven array of n integers and given a number X, find all the unique pairs of elemens (a,b), whoose some is equal to X.
- Anonymous January 17, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
Answerswrite down String class copy constructor ?
- siva.sai.2020 December 28, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answersfind a bug in following code : class A { public: static int i; void print() { cout<< i << endl ; } }; int main() { A a; a.print(); }
I run above code, and I am getting "ndefined reference to `A::i'" . Why I am getting this error ?
- siva.sai.2020 December 28, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersWhen would a teleportation device not increase the speed of your commute?
- sat December 15, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Brain Teasers - 0of 0 votes
AnswersHow would you test a Elevator?
- Anonymous December 14, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersExplain one of your project you have done in your past and what challenges did you face in that? If given one chance what would you like to change in the project you worked on
- Anonymous December 14, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Java