Microsoft SDE Test Interview
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.

Add New Comment
Viewing 12 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)