Interview Questions

Microsoft Interview Question for SDE in tests

Microsoft Interview Questions and Answers


(Continued from previous question...)

9. Microsoft Interview Question for SDE in tests

1. Question:
A new USB memory device is designed with the following functionalities.
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

Write the test cases.



2. Question:
find the number of solutions (non-negative integral) for the equation x1+x2+x3+x4+x5=20.
ie, #((0,0,0,0,20),(0,0,0,20,0),....)
12



3. Question:
write a function to reverse a linked list in the following fashion.
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.
9


maybe an answer for 3. Question:
use recursion . in each recursion revrese N nodes
node reverse(node head,int n)
{
if(head==null)
return null;
node p,q=null,temp=haed;


while(k--)
{
p=q;
q=temp;
temp=temp.next;
q.next=p;
}
head.next=reverse(temp,k);
return Q;
}
{
if(head==null)
return null;
node p,q=null,temp=head;
while(k--)
{
p=q;
q=temp;
temp=temp.next;
q.next=p;
}
head.next=reverse(temp,k);
return q;
}

(Continued on next question...)

Other Interview Questions