Testing Interview Questions | Glassdoor

# Testing Interview Questions

3,128

Testing interview questions shared by candidates

## Top Interview Questions

Sort: Relevance Popular Date

### Software Design Engineer In Test at Amazon was asked...

Jul 28, 2012
 Roman to Int 2 Answers create a dictionary of std. roman values, parse through the roman string and match with the dictionary values -- keep incrementing the output as you iterate and keep truncating the input string as you go through Your answer is incorrect. This is how you should have done it: public static int romanToLatin(String romanNumber) throws Exception { HashMap romanLetters = new HashMap(); romanLetters.put("I", 1); romanLetters.put("V", 5); romanLetters.put("X", 10); romanLetters.put("L", 50); romanLetters.put("C", 100); romanLetters.put("D", 500); romanLetters.put("M", 1000); int stringLength = romanNumber.length() - 1; int result = 0; int last = 0; int sign = 1; int current; for (int i = stringLength; i >= 0; i--) { current = romanLetters.get(romanNumber.subSequence(i, i+1)); if (current > last) { result += current; sign = 1; } else if (current == last) { result += current * sign; } else { result -= current; sign = -1; } last = current; } return result; }

### Software Engineer In Test at Palantir Technologies was asked...

Mar 18, 2010
 Given some binary number, how would you determine whether the 5th least significant digit is a 1 or a 0? 2 Answers 1st solution: divide the number by 2 4 times to make the 5th digit the 1st digit, then AND it with 1. better solution: AND the whole thing with 16 printf (" 5th bit is %d\n", number & 0x10 ? 1 : 0 ); // (or as mentioned above -16)

Aug 28, 2010

### 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

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

Jan 16, 2011
 Find cycle in linked list. 2 Answers 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. If 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.

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

Mar 23, 2011
 Write a function to recursively reverse a string. 2 Answers #include string stringReverse(string str) { if (str.length() > 0) { return str[str.length() - 1] + stringReverse(str.substr(0, str.length() - 1)); } else { return ""; } } public static String strRev(String st) { if (st.length()>0){ return (st.charAt(st.length()-1) + strRev(st.substring(0,st.length()-1))); } else return " "; }

### 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.,

Nov 14, 2013