Software Development Engineer II Interview Questions | Glassdoor

# Software Development Engineer II Interview Questions

251

Software development engineer ii interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Software Development Engineer In Test (SDET) II at Microsoft was asked...

May 2, 2011
 Given a BST find the second largest element?2 AnswersSince A binary search tree is arranged into subtrees such that, the left subtree contains the values which are less than the root node and the right subtree contains the values which are larger than the root node. So, the largest element will be the Rightmost element of the right subtree. And the SECOND largest element will be it's parent. int findSecondLargest(tree *root) { tree *ptr, *prevPtr; prevPtr = NULL; ptr = root; while( ptr->right != NULL) { prevPtr = ptr; ptr = prevPtr->right; } if (ptr->left == NULL) return (prevPtr->info) ; // if ptr is the rightmost leaf node, then return its parent node // else if it has a left subtree then return the rightmost node in the left subtree. prevPtr = ptr; ptr = ptr->left; while (ptr ! = NULL) { prevPtr = ptr; ptr = ptr ->right ; } return (prevPtr->info) ; }Node findSceondLargest(Node root) { // If tree is null or is single node only, return null (no second largest) if (root==null || (root.left==null && root.right==null) return null; Node parent = null, child = root; // find the right most child while (child.right!=null) { parent = child; child = child.right; } // if the right most child has no left child, then it's parent is second largest if (child.left==null) return parent; // otherwise, return left child's rightmost child as second largest child = child.left; while (child.right!=null) child = child.right; return child; }

### Software Development Engineer In Test (SDET) II at Microsoft was asked...

Jan 16, 2011
 Find cycle in linked list.2 AnswersIf the size of the list is known, the solution is to iterate through the list and keep counter until the counter reaches to the size+1 or the list ends. in first case it will mean the list has cycle, in second case, it has no cycles. If the size is unknnown, keep a map/list of the nodes during iterating thru the list. during each iteration, check whether the node exists in the maintained map or not. If yes, the list has cycle, otherwise, add that node to the list and continue to next iteration. Repeat this untill either list ends (no cycles) or the node is found in temporary tracked map of the nodes.State that you have 2 or more nodes in the list before you begin. Have two pointers P1 & P2. Have pointer P1 point to node #1 and P2 to node #2. Move the pointers : such that, for every node move of P1, P2 moves 2 nodes. (Eg): P1 = P1 -> link P2 = P2 -> link -> link If at any point if P1 and P2 point to the same node, then it means that the list is in a loop. Try this with a few connected nodes in a properly formed linked list to prove to yourself.

### Software Development Engineer II at Microsoft was asked...

Aug 3, 2010
 Different Sorting Algorithms and Big O of each 2 AnswersAverage cases: Heap sort O(n lg n) Insertion sort O(n^2) Quicksort O(n lg n) Merge sort O(n lg n) Bubble sort O(n lg n)Bubble sort is O(n2)..

### Software Development Engineer (SDE) II at Microsoft was asked...

Jul 17, 2014
 Write a function to remove duplicates from a list of characters.1 AnswerIf you have a sorted array of integers, how would you best remove duplicate values?

### Software Development Engineer II at Amazon was asked...

Jun 7, 2013
 Standard Software Development interview questions. Check careercup.com or leetcode.com for lots of examples. Popular interview question: Implement the floodfill (aka paint bucket) function of the Windows Paint program.1 Answer+ Propose a 2D matrix of pixels to represent the screen. + Distinguish between a four way (left, right, up, down) fill, and an eight way fill (previous 4 ways + diagonals) + Clarify the use of colors, B/W or use an enum for the supported colors, etc. Then do it recursively or iteratively, by painting a pixel or ignoring it. If painting a pixel, repeat for its adjacent pixels, otherwise, return.

### Software Development Engineer II at Microsoft was asked...

Jun 5, 2015
 Write 4 locker functions: acquire_read_lock, acquire_write_lock, release_read_lock, release_write_lock. Use Windows specific helper functions. 1 more brain teasing puzzle.1 AnswerI never developed on Windows-specific app or other OS modules, so totally screwed up.

### Software Development Engineer II at Microsoft was asked...

Apr 5, 2012
 Comtinuous performance improvement of a prime-number algorithm optizing for various characteristics.1 AnswerMore than an hour demonstrating intimate knowledge of how a microprocessor execcutes code.

### Software Development Engineer In Test (SDET) II at Microsoft was asked...

Oct 11, 2010
 how to reverse words in a string preserving the formatting2 Answersgoogle itpublic void ReverseWords(StringBuilder sb) { if (sb == null) { return ; } String tempStr = ""; int start = -1; int end = -1; //"My na" for (int i = sb.Length -1; i >= 0; i--) { if (sb[i] == ' ') { if (end != -1) { start = i + 1; // end = 4 // start = 3 while (start <= end) { tempStr = tempStr + sb[start]; start++; } start = -1; end = -1; } tempStr = tempStr + sb[i]; } else { if (end == -1) { end = i; } } } if (end != -1) { for (int i = 0; i <= end; i++) { tempStr = tempStr + sb[i]; } } Console.WriteLine(tempStr); }

### Software Development Engineer II at Expedia was asked...

Nov 4, 2012
 Given a balance and marbles where one marble weighs more than the other, how many times do you have to use the balance to find the heaviest marble for 7 marbles. Then, extend that answer to how many marbles can you weigh with 4 tries.3 AnswersQ: how many times do you have to use the balance to find the heaviest marble for 7 marbles Answer : Twice Explanation: 1 . Put three marbles at the each side of balance leaving one. If both of the sides of balance are equal , then the one left is the heaviest. if not take the three marbles which weight more. 2. Among out of 3 from above collection , put one at each side of balance and leave the third one. If both side of balance is same then the marble left is heaviest. Or the marble which weigh more in the balance is the heaviest.Put any four marbles at the each side of the balance leaving three If both of the sides of balance are equal then select any 2 marbles out of the left 3 marbles and weight If both sides of balance are equal then the left one is heaviest Otherwise the marble which weight is more is the heaviest Otherwise weight the marbles that is on heaviest side and one of them is the heaviest one1) 2 tries. 3 vs 3 first. If both are equal it means that the remaining marble is the odd one. If both aren't equal then do 1 vs 1 weigh. 2) 31 marbles. The max number of marbles you can differentiate between with 1 try is 3. For each subsequent try double the previous number and add 1.For 4 tries that would be 31.

### Software Development Engineer In Test II at Amazon was asked...

Jul 20, 2010
 Design a parking lot using OOPS.1 Answerhttp://stackoverflow.com/questions/764933/amazon-interview-question-design-an-oo-parking-lot
1120 of 251 Interview Questions