Testing Interview Questions | Glassdoor

Testing Interview Questions

3,264

Testing interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Describe and code an algorithm that returns the first duplicate character in a string?

7 Answers

Simple Python example. Not sure it's most efficient. def findDup(str): match=[] i=1 while (i<len(str) and len(match)==0): for j in range(i): if str[j]==str[i]: match=[j,i] i+=1 return match if __name__ == '__main__': print findDup('asdf') print findDup('asdfasdf') pass

first clarify if it is ASCII or UNICODE string For ASCII, create BOOL checkArray [128] = {false}; walk the string and update the index of checkArray based of the character. for (int index=0;index< strlen(str); index++) { if (checkArray[str[index]] == true) { printf (str[index]); return; } else { checkArray[str[index]] = true; } }

public class FirstDupCharacter { public static void main(String[] args) { System.out.println(findDupCharacter("abcdefghiaklmno")); } private static Character findDupCharacter(final String input) { final Set set = new HashSet(); Character dup = null; for (int i = 0; i < input.length(); i++) { if (set.contains(input.charAt(i))) { dup = input.charAt(i); break; } else { set.add(input.charAt(i)); } } return dup; } }

Write a method to decide if the given binary tree is a binary search tree or not.

4 Answers

how can a particular application be tested apart from testing its functionality

3 Answers

In a given sorted array of integers remove all the duplicates.

6 Answers

Implement a binary tree and explain it's function

4 Answers

Write code in your favorite programming language that will accept two strings and return true if they are anagrams.

2 Answers

Given a string (understood to be a sentence), reverse the order of the words. "Hello world" becomes "world Hello"

1 Answer

What would you do if management asks you to approve a release with critical defects?

1 Answer

Phone interview 1 : a) Simulate a Queue with stacks ? b)Find repeated occurrence of character in a string ? Phone interview 2 : a) Given a 2D matrix of numbers find the position of number . Constraints of matrix number always in increasing order left to right and top to bottom . b)When should version control be used . And a tricky discreet math problem ?

13 Answers

How would you determine if someone has won a game of tic-tac-toe on a board of any size?

14 Answers
110 of 3,264 Interview Questions