Microsoft Interview Questions
- 0of 0 votes
AnswersHow will you detect if two rectangles intersect and find their intersection. Write test cases for same.
- Anil February 22, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPrint a 2D array spirally.
- Anil February 22, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays - 0of 0 votes
AnswersWrite test cases for copy command in UNIX.
- Anil February 22, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Testing - 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
AnswersReverse a linked list using recursion
- Vineet February 21, 2011| Report Duplicate | Flag | PURGE
Microsoft Jane Street Software Engineer / Developer Linked Lists - 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
AnswersThe scenario was something like that:
- Praveen February 10, 2011
You have to create a graph in most efficient way from relationship of nodes read from txt file.
text file contains information like:
node_id weight node_id
node_id weight node_id
.....
// which means two nodes are connected with some weight. (undirected)
There are around 600K such information for about 65000 nodes.
Aim is to create a a subgraph for a given node_id. i.e for that node_id find ALL successor nodes with level mentioned i.e form a subgraph for that node.
He was looking for c++ code and most efficient algorithm.
Inputs are invited.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C++ - 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 - 4of 4 votes
AnswersIf [a1,a2,a3...,an,b1,b2...bn] is given input change this to [a1,b1,a2,b2.....an,bn] , solution should be in-place
- Anonymous February 05, 2011| Report Duplicate | Flag | PURGE
Amazon Microsoft Developer Program Engineer Software Engineer / Developer Algorithm Arrays - 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
AnswersInsert a node in a sorted Circular singly Linked List ?
- Anonymous February 01, 2011
Followup Question
1. When you need to insert the new node in head, optimize the code| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersAlgorithm to solve Sudoku and implement the code
- Anonymous February 01, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer 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
Answersproblem of binary matrix
- SDE February 01, 2011
Given a binary matrix of N X N of integers , you need to return only unique rows of binary arrays
eg:
0 1 0 0 1
1 0 1 1 0
0 1 0 0 1
1 1 1 0 0
ans:
0 1 0 0 1
1 0 1 1 0
1 1 1 0 0| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer 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
AnswersMerge 2 sorted linked lists into one
- libran January 30, 2011| Report Duplicate | Flag | PURGE
Microsoft C - 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
AnswersImplement an algorithm to print out all files below a given root node.
- aammgg January 28, 2011package file; import java.io.File; public class PrintFile { private void printFile(File file){ File[] childFilesList = file.listFiles(); if(childFilesList !=null && childFilesList.length>0){ for(File childFile : childFilesList){ if(childFile.isDirectory()){ printFile(childFile); } else{ System.out.println(childFile.getName()); } } } } public static void main(String args[]){ PrintFile printFile = new PrintFile(); printFile.printFile(new File("C:\\Shared")); } }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersparagraph is given find out the second largest word in given space and time.
- Anonymous January 25, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer