Microsoft Interview Questions
- 4of 6 votes
Answersgiven an int array with no duplicate numbers, write a function to return number of ways to calculate a target number.
- cooldog March 15, 2013 in United States
example: given {2,4,6,8} Target = 12
2 + 4 + 6 = 12,
4 + 8 = 12,
6 + 8 - 2 = 12,
2 - 4 + 6 + 8 = 12,
return 4| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Software Engineer in Test - 11of 11 votes
AnswersGiven a string, find whether it has any permutation of another string. For example, given "abcdefg" and "ba", it shuold return true, because "abcdefg" has substring "ab", which is a permutation of "ba".
- sg March 02, 2013 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test String Manipulation - 0of 0 votes
AnswersYou come to office install the latest build of internet explorer and find out that instead of the expected page explorer loaded a blank screen .. before discussing with developer what test you will like to conduct so that he can pin point the problem from your observation
- vik February 25, 2013 in United States for Internet Explorer| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 2of 2 votes
AnswersThere is an machine which can process any kind of fruit and produce packaged boxes … write test cases for that
- vik February 24, 2013 in United States for Internet Explorer| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 1of 1 vote
AnswersWrite a function that gets a number n and prints out a random list
- fly123 February 01, 2013 in United States
of numbers 1..n to the screen. For example:
randlist(5) : 1 5 3 2 4
randlist(6) : 4 6 1 5 3 2
This should be truly random (uniformly spread) and with a O(n) complexity.
Every number should appear only once. Random(n) is given as a tool you can use to generate a
single random number between 1-n| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding - 0of 0 votes
AnswersGiven a two dimensional matrix of booleans, there is a function that returns the number of "true regions".
A region is a group of True values aligned vertically or horizontally.T T <= 1 region T F T F <= 2 regions F T
Question 1: How would you test a function that solve this problem, but is written by another developer. How many tests cases do you see?
- hnrqbaggio January 24, 2013 in United States for Office
Question 2: Now write the code to solve this problem. What are the time and space complexities?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm Arrays Data Structures Debugging Microsoft Testing - 1of 1 vote
AnswersGiven a string, find the start position of the largest block of repeated charactes.
- hnrqbaggio January 24, 2013 in United States for Office
After the solution, I was asked to write down as many test cases I could to test the function as if it was created by someone else.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm Microsoft String Manipulation Testing - 1of 1 vote
AnswersGiven two arrays of ints that are sets, create a function to merge them to create a new set.
- hnrqbaggio January 24, 2013 in United States for Office
A set must pass on these three conditions:
- All values are positive
- Sorted
- Non-duplicates| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm Arrays Data Structures Debugging Microsoft - 0of 0 votes
AnswersTell me if a array of integers is a set.
- hnrqbaggio January 24, 2013 in United States for Office
A set must pass on these three conditions:
- All values are positive
- Sorted
- Non-duplicates
After the first solution, I was asked about time and space complexity and to create 5 test cases for my function.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm Arrays Data Structures Debugging Microsoft - 1of 1 vote
Answersdesign Malloc Function which user can call and get the allocation. For example, there is a Byte array of byte[1000] so if use call getAllocation(3) then we will assign 3 bytes to user. and again if another user call getAllocation(100) then we will assign again,
- Andy2000 December 22, 2012 in United States for STB| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 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 - 1of 1 vote
AnswersWAP to print the node values of a binary tree
- yakku October 22, 2012 in United States
- Even level starting from right to left
- Odd level starting from left to right
Assume that level of root is 1.
a
b c
d e f g
Output: a c b d e f g| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersAssume you have a integer matrix (m x n) sorted over column wise & row wise. WAP to find the kth smallest element from the matrix.
- yakku October 22, 2012 in India
E.g.
int[][] a =
2, 5, 8, 10
4, 7, 9, 12
6, 15, 20, 22
So 5th smallest element is: 7| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 1of 1 vote
AnswersWrite code to sort an integer array of size N which has only three unique values 0,1,2 duplicated & randomly placed over the entire array.
- yakku October 22, 2012 in India
- Memory used should be O(1)
- Run time should be O(N)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 1of 1 vote
AnswersAssume that a binary tree is drawn over a Cartesian coordinate system (with X & Y axis) where the leftmost node is placed at point (0,0). So, we need to traverse the nodes and print in following manner:
- yakku October 22, 2012 in India
For e.g., for this tree
a
b c
d e f g
Output should be:
d,0,0
b,1,1
e,2,0
a,3,2
f,4,0
c,5,1
g,6,0| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 1of 1 vote
AnswersGiven a sum find(print) all 2 numbers and their index positions from an un-ordered array that add up the sum value. 1 4 4 3 7 5 8 as array and sum =8 .
- M October 06, 2012 in United States for Server tools division
So here the code should print 1 (index 0) + 7(index 4)
4(index 1)+ 4(index2), and so on..| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 1of 1 vote
AnswersHow do you test a Calendar? (eg. An outlook calendar or google calendar)
- M October 06, 2012 in United States for Server tools division| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersGiven two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be made with its own memory — the original lists should not be changed.
- soni vashisht September 30, 2012 in United States
For example, let the first linked list be 1->2->3->4->6 and second linked list be 2->4->6->8, then your function should create and return a third list as 2->4->6.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersGiven two numbers represented by two lists, write a function that returns sum list. The sum list is list representation of addition of two input numbers ?
- soni vashisht September 30, 2012 in United States
Example First List: 5->6->3 // represents number 365
Second List: 8->4->2 // represents number 248
Resultant list: 3->1->6 //
Note :Any Carry forward should also be added as the new node . Any Comments on the code below| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
Answers/*Find MagickNumber With Duplicate Numbers in Sorted Array 2. Consider a sorted array with all unique numbers. Where a magick number[i] =i */
- soni vashisht September 17, 2012 in United States
/* -10,-5,2,2,2,2,4,7,9,12,13
* */
Why the MAGICK Index be on the left side ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersNeed to Print all the elements of the ArrayList consisting an ArrayList using C# ?
- soni vashisht September 17, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C# - 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.
- Aashish August 22, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 1of 1 vote
AnswersGiven an array with positive, negative and zeros, arrange the given array such that negatives are on left, zeros in the middle and positives on the right.
- babbupandey August 20, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm Arrays - 0of 0 votes
AnswersDesign Chess Game. asked me this in testing interview.
- Andy2000 August 16, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 1of 1 vote
AnswersYou have a circular Linked List:
- Andy2000 August 16, 2012 in United States
a->b->c->d->e->c
Find where the cycle is starting| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 1of 1 vote
AnswersYou have 2 sorted Arrays. A and B. A is shorter than B. B has few elements in sorted order and has space for all elements of A. Now Merge these both array so that All elements are sorted. You cant use extra Array. Use Only Array B.
- Andy2000 August 16, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Arrays - 1of 1 vote
AnswersThis is one of the interesting questions asked to my friend who had a telephonic with Microsoft recently:
- Jeanclaude July 25, 2012 in United States
Question: Imagine you have a device that is used to count the number of leaves in a tree. And it has an output screen which displays how many leaves are present in a tree, plus a start/stop button. Write as many test cases as possible and sort them under as different test buckets as possible.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing - 0of 0 votes
AnswersWrite a code in C for the following:
- jeanclaude July 09, 2012 in United States
Starting from 1, assign an alphabet to each integer, for e.g. if input is 1 then A should be the output), 2 = B ....... 26 = Z. Similarly, 27 = AA, 28 = AB..........52 = AZ. 702 = ZZ, 703 = AAA and so on. The function takes only one integer argument . for e.g ConvertToAphabet(int x). One additional consideration here is, the user is free to provide any length of integer (bigint long int etc), no restriction there.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C - 0of 0 votes
AnswersConsider you have a grid of size m x n. There are stones placed randomly in some of the squares of this grid. Design a way to find out minimum rectangular area which covers all the stones in this grid.
- bobbysanders007 July 01, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersA) Write a function that takes input as integer and converts it into a linked list where each node represents a digit of the input integer.
- bobbysanders007 July 01, 2012 in United States
e.g. i/p : 123
expected result: [1] => [2] => [3] => [null]
(catch: don't forget to consider case of negatives like -433 etc.)
B) Write a function that takes input as two linked lists shown as above (which are basically integers represented in linked list format) and calculate sum.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm