Microsoft Interview Questions
- 0of 0 votes
AnswersSuppose we have an array like
- newtonsright October 24, 2011 in -
1,2,3,4,5,a,b,c,d,e where we have always even number of elements.First half of the elements
are integers and second half are alphabets we have to change it to like
1,a,2,b,3,c,4,d,5,e in place i.e no use of any extra space, variables are allowed ..| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Algorithm - 0of 0 votes
AnswersFor the given number need to find out the possible BST. eg, if the given number is n means we should find BSTs using 1,2..n. n=5 means figure it out using 1,2,3,4,5, how many BST we can make?
- JobHunter October 22, 2011 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersHow much memory will be allocated from the "stack" for the following declarations together?
- devanharikumar89 October 20, 2011 in India
int *a;
char *b;
This was an objective question. a and b have not been malloced yet.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersA new USB memory device is designed with the following functionalities.
- devanharikumar89 October 19, 2011 in India
1. when connected to a camera, it opens the data transfer wizard.
2. When connected to another storage device, it copies data.
3. When connected to a smart phone, it sync's. the contacts
<there were a couple of others too.>
Write the test cases.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answerswrite a function to reverse a linked list in the following fashion.
- devanharikumar89 October 19, 2011 in India
given: a list : a b c d e f
a number N
output should be: if N=2
b a d c f e
if N=3
c b a f e d
ie, the list should be reversed in <N><N>...<N> intervals. We are not allowed to allocate any new nodes.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answersfind the number of solutions (non-negative integral) for the equation x1+x2+x3+x4+x5=20.
- devanharikumar89 October 19, 2011 in India
ie, #((0,0,0,0,20),(0,0,0,20,0),....)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
Answersfind the index of the highest bit set of a 32-bit number (without loops obviously)
- pavel.em October 18, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft Bit Manipulation - 0of 0 votes
Answersassume you have a program which constantly crashes at some place. Yet, if you insert a 'printf' statement at this place, it magically begins to work.
- pavel.em October 16, 2011 in -
What does this indicate ? How can you trace the problem ?| Report Duplicate | Flag | PURGE
Microsoft C++ - 0of 0 votes
AnswersConvert a binary search tree to a sorted doubly linked list in O(n) time and in place. Manipulate the existing tree. Donot create a new tree.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Data Structures Trees and Graphs Algorithm - 0of 0 votes
AnswersFind the maximum continuous sum in an array. The array will contain at least one positive integer. Report the actual sequence. If there are multiple sequences report any one.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Coding - 0of 0 votes
AnswersSort a link list using merge sort.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Linked Lists - 0of 0 votes
AnswersDesign and implement a garbage collector in c++.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C++ - 0of 0 votes
AnswersSuppose you are passing a string to a Formatter function. Get the formatted news feed output string such that* There should be one sentence per line.* There shouldn't be any spaces i.e. the line shouldn't be blank.
- ANONU October 09, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersGiven a string S of words and no of character per line m ,with m being greater than the longest word in S,print S in a set of lines so that each line contains no more than m characters and no word split between 2 lines.
- ANONU October 07, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersWrite a program which gives a numerator and a denominator, prints the fractional value in a special format. eg. Numerator: 1, Denominator: 3. So Num/Denom = 0.3333333333, but output should be .(3) similarly 0.123123 as .(123) also 0.34232323 as 0.34(23)
- ANONU October 07, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
Answers#include<stdio.h> int main() { int i,j; j = 10; i = 3; //i = j++ - j++; //i = i++ + ++i; //i = j++ - j++ + i++ + ++i; printf("%d\n", i); }
If I un-comment the first comment then output = 0
- learner October 06, 2011 in India
if second then output = 9
if third then output = 8
Please explain why this is so| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
Answersmain() { int i,j; j = 10; i = j++ - j++; printf("%d %d", i,j); }
The output of this is 0, 12
- learner October 05, 2011 in India
can anyone please explain me the logic| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersGiven a singly linked list with a loop. Find exact location (the element number) where the loop starts. Obviously, using O(1) space (this also means you are not allowed to associate any data with the list elements)
- pavel.em October 03, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
Answersfind out
- ANONU October 02, 2011 in -
missing no. from a stack if two given stacks have same numbers| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
Answers2)next question is given an
- ANONU October 02, 2011 in -
array of integers...like 10 12 16 17 24 27 8 6 5 4 2....first from 10 to 27 it is in increasing order... .and then decreasing order
starts....so he asked me to find the position from where decreasing starts....it should be done in O(logn).| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
Answersgiven a 32-bit integer x
find the smallest integer x0 > x
with the same number of ones in binary representation
Example:x = 76 x0 = 81
solution without loops and additional storage ?
- pavel.em October 02, 2011 in -| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Bit Manipulation - 0of 0 votes
AnswersFind the number of ways of placing 3 balls in 3 buckets. buckets are of diff capacity.
- insigniya October 01, 2011 in India
bucket1 can hold 2 balls
bucket2 - 3 balls
bucket3 - 2 balls.
ex. 1 1 1 is valid
0 3 0 is valid| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersgiven a polynomial f(x) of degree n, i.e.:
f(x) = f[n]*x^n + f[n-1]*x^[n-1] + ... + f[0]
propose an efficient algorithm to computing
the coefficients of g(x) = f(x+1), assume arithemtic overflow cannot occur.
- pavel.em September 28, 2011 in -Example: f(x) = 5*x^2 + 3*x - 1 g(x) = f(x+1) = 5*x^2 + 13*x + 7
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersa linked list contains
- ANONU September 25, 2011 in -
2 19 _ _ 3 47 _ _ _ 2 20 _ _ ..............and so on
I have to fill those empty nodes with numbers whose sum is equal to the numbers
occurring just before the gaps and the number of gaps is determined by the node
which is at 2 distance before the gaps with the limitation that there would be no
repetition in list only the nodes designating the number of gaps can be repeated
for example 2 20 should be broken in two parts like 19 1
3 47 should be broken in three parts like 42 2 3
and not in 44 1 2 because 1 already occurred in the list due previous partition| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersYou are given a string sequence and program need to output the number of times consecutive character sequences happen for increasing sequence length. eg. aabbababbd has 2 sequences as a followed by a, b followed by b. The for sequence length 2, ab followed by ab at 5th position. This is to be coded in minimum complexity.
- nitatbit September 18, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Coding