Microsoft Interview Questions
- 0of 0 votes
AnswersWrite a function which determines whether provided string matches specified pattern. Signature:
- Max December 25, 2010
bool is_match(char* text, char* pattern)
Pattern can contain any characters + '*' character which means zero or more characters. For example: is_match("hello", "h*o") returns true; is_match("hello", "hel*lo") also returns true.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer String Manipulation - 0of 0 votes
AnswersDIVIDE TWO VARYING LENGTH NUMBERS
- new December 17, 2010
EX: ONE CAN BE UPTO 60 DIGIT AND OTHER 40 DIGIT| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersA program has two functions 'reader_func' and 'writer_func'. The reader_func reads shared data and contains a critical section. The writer_func writes to shared data and contains a critical section.
Reader threads call reader_func. Writer threads call writer_func.
The condition is multiple reader threads can access the critical section at the same time as long as they don't access the critical section along with a writer. Only a single writer thread can access the critical section, i.e. no reader or other writer threads are allowed.
Give the code segment, add code that uses mutexes that controls access to the critical sections so that the shared data is not corrupted and satisfies the give conditions. You can create as many mutexes and global variables as you want. Don't emphasize too much on syntax as to how to acquire and release locks on mutexes. Just use mutex.acquire() and mutex.release() .
Code segment:
- spookymulder83 December 17, 2010void reader_func() { //critical section } void writer_func() { //critical section }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Threads - 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 - 0of 0 votes
AnswersWhy Microsoft? Why did you choose this major for Masters. what are good coding practice? How do you grade yourself as a coder/programmer.
- Anonymous December 14, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Behavioral - 0of 0 votes
AnswersGiven a sorted array with duplicates and a number, find the range in the form of (startIndex, endIndex) of that number. For example, given 0 2 3 3 3 10 10 and 3, return (2,4). Given the same array and 6, return (-1,-1).
- Isaac December 13, 2010
Upon further probe:
1. Do better than linear scan, which is O(n). 2. You can just work out how to find the start index, and I will assume that you know how to find the end.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersfind next palindrome of a number.
- Anonymous December 12, 2010
eg 125 next palindrome is 131| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersGiven a very large array of n integers, find the kth largest value in the array efficiently. You may assume that k is much smaller than n.
- Anonymous December 10, 2010
e.g. the third largest (k=3) of [1,3,2,2] is 1, not 2.| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswersRound 5: with Director
- sachin323 December 08, 2010
Write a function to get lowest common ancestor in "binary tree"| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 4:
- sachin323 December 08, 2010
write a insert function to insert into binary search tree node *insert(node *root);
Follow up :
Whats the problem with this ?
Ans: skewed tree for sorted inputs
Discuss algo that will avoid this ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersRound 1 :
suppose you are given a function void NumberofSum(int n) , write a code such that will print all the numbers that will sum up to n
- sachin323 December 08, 2010For Ex. n output 1 {1} 2 {(1,1) , (2)} 3 {(1,1,1), (1,2) , (3)} 4 {(1,1,1,1),(1,1,2),(1,3),(2,2) , (4)}
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersinterview:
- Anonymous December 05, 2010
Implement run length encoding and decoding.
Input:
aabbccaa encode:2a2b2c2a decode will be the input
Input: abcd encode:abcd decode:abcd
input:3122a encode:3122a decode:3122a
etc.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answerstest atof(char *s)
- Anonymous December 05, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answerswritten test:
- Anonymous December 05, 2010
print all the leaves of a binary tree(may not complete) as a link list.
1
/\
2 3
/\
4 5
output as a list: 4->5->3->NULL| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersHow do you test a function which would return the second smallest number in a BST?
- Guest December 04, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersBangalore written test
- Anonymous December 04, 2010
fucntion prints given 2d array in spiral fashion. give all test cases to test it| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding - 0of 0 votes
AnswersString s1 = bacdeg
- Anonymous December 04, 2010
String s2 = bcdaeg
write an algorithm which will return position of first character of string s1 that is appearing in s2
here postion of 'a' in string s2 as it is the first character of s1 that is coming in s2| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersBangalore written test
- Anonymous December 04, 2010
C function was given to find out the occurance of character "A" from an array. Need to find out the bugs in program.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding - 0of 0 votes
AnswersImplement Stack using Queues?
- Chandra Sekhar November 29, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Data Structures - 0of 0 votes
AnswersIf you were asked to design an efficient elevator system for a 100-storey building, enumerate the list of questions you would ask that you feel would be important to get answered before you start your design.
- skagrawal10 November 27, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswerYou are developing a component that requries parsing a lot of XML tags. You have abstracted the responsibility of finding the handler to a class named XMLElement Dictionary. Your will be invoking GetHandlerTag method of this class to find the corresponding handler method for a given element name (code snippet is shown below).
- skagrawal10 November 27, 2010
Typedef HRESULT(*PFNElementHandler)(IXMLAttribute* pAttributes, unsigned_int32nAttributes);
PFNElementHandler pfnElementHandler =( PFNElementHandler)
xmlElementDictionary.GetHandlerTag(elementName);
if(NULL!=pfnElementHandler)
{
(*pfnElementHandler)(pAttributes, nAttributes);
}
1. Define a datastructure that you will use inside this class to store the XML tags that you can use in your lookup logic for the fastest possible lookup on a given hardware. Call out your assumptions.
2. Implement the GetHandlerTag method.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersA mail server exposes an interface as mentioned below. When given a day in the calendar a user, it gets the meetings mentioned as slots in calendar with start and end time for each meeting.
- skagrawal10 November 27, 2010
CalendarSlot *GetMeetings(char[] username, unsigned int day);
typedef struct
{
unsigned int StartTime;
unsigned int endTime;
}CalendarSlot
The developer has implemented a mail client function as mentioned below. This function takes in a list of users, internally uses the GetMeetings mail server interface to get the list of meetings for those users. Eventually, it gives out the first 10 free slots, within the next 3 days from the day specified, which is of the mentioned slotDuration. Everyone in the userList have to be free from meetings during these slots returned, without exception.
Assumptions:
1. Meeting start time and end times will align at the beginning of an hour (8:00,9:00etc....)
2. SlotDuration will be in multiple of full hours (1hrs, 2hrs,etc....)
CalendarSlot * GetFreeSlots (char [][] userList, unsigned int day, unsigned int slotDuration)
Write the test cases for testing GetFreeSlots function. NOTE: Assume that GetMeetings function is already well tested.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 1of 1 vote
AnswersPrint nodes at k distance from a given node like :
- Gaurav.Singh November 26, 2010
both upper side and lower side| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm