Software Development Engineer In Test (SDET) Interview Questions | Glassdoor

# Software Development Engineer In Test (SDET) Interview Questions

414

Software development engineer in test (sdet) interview questions shared by candidates

## Top Interview Questions

Sort: Relevance Popular Date

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

Jan 23, 2012
 How to test a clock 2 Answers Open-ended question shape of clock, hands, size of hands congruent or not clockwise numbering legible numbers numbers in expected positions numbers equidistant clock has moving parts? (like a cuckoo clock) acceptible shape of clock replacing battery is intuitive? can it be hung on wall easily does is chime hourly reports time with accuracy after 1 12 24 hours changing time is easy? does it have multiple time zone clocks within its face or does it have only one ? etc.,

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

Jan 10, 2012
 Write a program in java that determines whether a string is a palindrome. 2 Answers The process I used was simple: Create a for loop that checks whether the letter at i and the letter at length-i are the same. If they are the same until i = length/2, accounting for both even and odd situations, then it's a palindrome. If you are ask to use recursion to solve the palindrome exercise study this code. public class Palindrome { private String pal; public Palindrome(String initPal) { pal = initPal.toUpperCase(); } public boolean isPalindrome() { if (pal.length() <= 1) { // String has only one character so it // is a Palindrome by definition. return true; // BASE CASE. } // Get the first and last characters of the String. char first = pal.charAt(0); char last = pal.charAt(pal.length()-1); if (Character.isLetter(first) && Character.isLetter(last)) { // The first and last characters are both letters.. if (first != last) { // The first and last letters are different // so the string is not a Palindrome. return false; // BASE CASE. } else { // The first and last characters are both letters, // and they are both the same. So, the string is // a palindrome if the substring created by dropping // the first and last characters is a palindrome. Palindrome sub = new Palindrome( pal.substring(1,pal.length()-1)); return sub.isPalindrome(); // RECURSIVE CASE. } } else if (!Character.isLetter(first)) { // The first character in the string is not a letter. // So the string is a palindrome if the substring created // by dropping the first character is a palindrome. Palindrome sub = new Palindrome(pal.substring(1)); return sub.isPalindrome(); // RECURSIVE CASE. } else { // The last character in the string is not a letter. // So the string is a palindrome if the substring created // by dropping the last character is a palindrome. Palindrome sub = new Palindrome( pal.substring(0,pal.length()-1)); return sub.isPalindrome(); // RECURSIVE CASE. } } public static void main(String[] args) { Palindrome p1 = new Palindrome("Madam, I'm Adam."); System.out.println(p1.isPalindrome())… Palindrome p2 = new Palindrome("Nope!"); System.out.println(p2.isPalindrome())… Palindrome p3 = new Palindrome("dad"); System.out.println(p3.isPalindrome())… Palindrome p4 = new Palindrome("Go hang a salami, I'm a lasagna hog."); System.out.println(p4.isPalindrome())… } }

Nov 14, 2013

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

May 2, 2011
 Given a BST find the second largest element? 2 Answers Since 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) at Microsoft was asked...

Dec 12, 2012
 You have an image and you have to find the average of the image i.e. average of all the pixels into one pixel. The pixel has 3 values, R, G and B. Each R, G and B is a 8 bit number. Write the code for it in C. 2 Answers Use MatLab's mean2() function on an RGB image. I guess the challenge is that if you just sum up all values of R, G, B in the picture, you'll overflow. It seems like you can do this via divide-and-conquer: Split the image in half, get the average for each half via recursion, then combine the averages (AVG_LEFT_HALF = SUM_LEFT_HALF/N/2, same for right half, therefore FULL_AVG = SUM_LEFT_HALF +SUM_RIGHT_HALF / n = 1/2(SUM_LEFT_HALF/N/2 + SUM_RIGHT_HALF/N/2)

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

Sep 7, 2010
 you have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). the second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), etc, until you only visit the 100th door. 3 Answers I was told to code it. This was fairly straight forward and I was guided through it. multiples! This might work bool[] doors = new bool[100]; for (int i = 1; i < 101; i++){//i is starting position and increment for(int ii = i; ii < 100; ii += i){ doors[ii-1] = doors[ii-1]==false?true:false; } }

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

Feb 16, 2012
 Implement strstr in the language of your choice. 2 Answers Here is an idea: public static class StringExtensions { public static int StrStr(this string original, string target) { int indexOriginal = 0; int indexTarget = 0; if (target.Length == 0) { return -1; } while (indexOriginal 0) { indexOriginal--; indexTarget = 0; } } else { indexTarget++; } if (indexTarget == target.Length) { return indexOriginal - indexTarget + 1; } indexOriginal++; } return -1; } } The code you written is O(m n). Try something O(m) where m is the string length, and n is the pattern length which needs to be searched. Try using KMP method.

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

Dec 2, 2011
 int Solve(string str); Given the signature above, implement the simplest method that returns the results of the following arguments: 1. “3+5” (8) 2. “10+2-8” (4) 3. “5+10*3” (35) 4. “3+5--6" (14) 2 Answers Don't forget about precedence when implementing this solution. For example, cases 1 & 2 can simply be evaluated from left to right, but case 3 needs to first have the * operator evaluated followed by the + operator. Isn't this the basic example of expression tree? Form the tree according to the precedence of the operators. Leaf nodes would be the actual numbers.

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

Jan 13, 2012
 Delete n-th element from linked list. Note, you don't have a pointer to the Head of the list. 2 Answers Good question but Need more information > which type of linked list? singly? circular? doubly? > delete nth - means deleting from front or end? Thanks in advance. Assuming a single linked list, copy over the data from n+1 node to n-th node and delete the n+1-th node

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

Feb 20, 2012
 Count no. of words in a string 2 Answers string test = "this is a test of a string count"; var result = test.Split(' ').Length; Assuming Word means a string of Alpha characters: def countWords(str): words=0 wording=str[0].isalpha() for i in range(len(str)): if str[i].isalpha(): wording=True else: if wording: words+=1 wording=False if wording: words+=1 return words if __name__ == '__main__': print countWords(' asdf asdf ') print countWords('as.....df5asdf') pass
3140 of 414 Interview Questions