Interview Question

Interview(Student Candidate) Redmond, WA

Implement a Find-Replace function given a string of text

  , search string, and replace string. Also a seemingly simple question became very difficult and complex when looked at through the eyes of a tester. A question involved writting a function to classify a triangle given its side lengths.

Interview Answer

2 Answers


The question about the triangle classification seemed simple enough but what they were really looking for was to determine flaws in the requirement specification. Was the specfication correct given how it's going to be used? Is it what the customer wanted? Does it offer value to our market in relation to our competitor? What type of platform do we expect it to run on? Any localization issues? Accessability? The most important things to show for SDET is that you have the ability to take a step back from the narrow problem at focus and see if it fits into the larger picture of the project and what it's trying to acheive for the customer.

Interview Candidate on Mar 7, 2014

For the Find-Replace function: Assuming only whole words are to be replaced: public void findReplace(String str, String word, String replace) { String[] words = str.split(" "); for(int i = 0; i < words.length; i++) { if(words[i].equalsIgnoreCase(word)) { words[i] = replace; } } str = ""; for(int i = 0; i < words.length; i++) { str += words[i] + " "; } System.out.println(str); }

Anonymous on Feb 21, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.