Elliott C. Back: Internet & Technology

Microsoft SDE Test Interview

Posted in Computers & Technology, Microsoft by Elliott Back on September 24th, 2005.

I just had a first round interview with Microsoft here on campus at Cornell University. I attended the tech career fair yesterday and dropped my resume, and got emailed to setup a time today to do the first screening interview. The guy who interviewed me didn’t have a copy of my resume, so I gave him one. His first comment, “Ohhh, so you worked for Amazon, did you?”

It seems that Microsoft is hungry to snap up current or former Amazon employees. How lucky for me.

Then we got into the interview, where he asked me to describe some software tests I’d worked on in the past, so I told him how I wrote lexical, syntactic, and semantic tests for our compiler last semester as unit tests. “Good” testcases for each stage called the compiler on their (and preceeding) stages only and would not generate exceptions. Invalid testcases were expected to throw exceptions. This way, we could throw dozens of different tests into the “valid” and “invalid” folders of each stage and completely automate most of the early testing.

To show I could test something, I had to write a function to identify equilateral, isosceles, and scalene trianges, returning a different integer for each. Then I discussed a test matrix for this function, which covered standard cases, negative or zero integers, overflow, NaN, floating point considerations, etc. Also, the permutations required to test non-equilateral triangles. The function looked something like:


<?php

function whatTriangle($a, $b, $c){
    if(
$a === $b && $b === $c)
        return
0;  // equilateral
    
if($a === $b || $b === $c || $a === $c)
        return
1;  // isosceles

    return 2;    // scalene
}

?>

Finally, we wrote another function to remove duplicate integers in an array. Woohoo! This was a standard MSFT coding question they’d ask in an interview–always something about arrays:

<?php

function removeDups(&$arr){
    
$j = 0;

    for($i = 1; $i < count($arr); $i++){
        if(
$arr[$i] === $arr[$j]) {
            continue;
        } else {
            
arr[++$j] = $arr[$i]
        }
    }

    return $j;
}

?>

This is a code sketch for a function that removes duplicates and returns the last index in the newly deduped array. If you were to do it properly, you’d want to check bounds and such and modify the length of the real array by resizing it.

Note: I am saving this post until I hear back from them again!

This entry was posted on Saturday, September 24th, 2005 at 6:05 am and is tagged with equilateral triangles, nbsp nbsp nbsp nbsp nbsp, test matrix, cornell university, msft, scalene, screening interview, amazon, first screening, isosceles, unit tests, integers, sde, permutations, time today, floating point, overflow, nan, folders, exceptions. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

12 Responses to “Microsoft SDE Test Interview”

  1. Fedra says:

    Hello Elliot

    Sounds like you had a pretty good interview…… I am looking for a strong SDET. Are you or anyone you know might be interested please let me know.

    We are a technology company here in Downtown Seattle, let me know if you or anyone you may know is interested. My email is fybraun@gmail.com

  2. viswa says:

    hey gravatar..

    all the best for the outcome.. u seem confident.. so u wud make it.. did u get ur result? could u pls tell what questions were u asked?

  3. ananomys says:

    Hi , I just came from a Microsoft face to face Interview in Redmond.In the morning Recruiter had told me that I would be meetng with 3 interviewers. 2 for 1 hour each and 3rd one more longer with lunch interview in between .
    I think, I have made my best and given most of the answers about testing problems, Link lists and all.I am satisfied with the same. My 3rd interview finish at 1 o’clock .It was followed by Product Team Manager who also took my telephonic interview and he jsut asked my day, my back ground and what do you looking forward to work in Microsoft, I think,I am best in that too and he is satisfied.

    Any one any idea or past experience if your interviews goes all well with people impressed and it finishes off by 1:30 PM. what does that mean ?

    Is it always that Microsoft has 5-6 rounds of interview till evening or that sometimes, they closes the same early as in my case.

    Any inputs are most welcome.
    I am optimistic though :) )

  4. Chris says:

    need more commenting space … you all get the idea

  5. Chris says:

    My programming question was to find the fibinacci number given an index.

    recursive:
    public int doFib(int a) {

    if( a == 0) {
    return 0;
    }elseif ( a==1) {
    return 1;
    }
    else {
    return doFib( a-1) + doFib( a-2);
    }
    }

    although recursive is the most common and easily understood, i think it is better to do it with loops,

    int doFib( int a) {

    //base case
    double zero = 0;
    double one = 1;

    double result = zero;
    for( int i = 0; i <a>

  6. Lee says:

    Hey man,
    I got a similar question ealier when I attend the interview…..!

    I agree with GRAVATAR …
    Hey GRAVATAR U are awesome man…!
    Its the question the interviewer posed me….(a+b > c || a+c>b || b+c>a) ?

  7. James says:

    I dont think that the whatTriangle works for all cases. Yes, you mentioned negative and zero bases, but how about this case (a+b > c || a+c>b || b+c>a)?

  8. Elliott Back says:

    Yes–sorting was a precondition =P

  9. Alan says:

    I hope your array question had specified that you’d get a sorted array. If the array was unsorted, I don’t think your code would catch it.

  10. Sara says:

    Nice job. I had a similar interview with Amazon actually when I went to the Univ of Wash. Didn’t get the job though!!

  11. Marco says:

    I do hope you’re not seriously considering working for Microsoft, do you? *scared*

  12. mr nice ash says:

    Wow… I am congratulating you as early as now.

    *Salutes Elliot* :)

Leave a Reply

Powered by WP Hashcash