Software testing Interview Questions | Glassdoor.co.in

# Software testing Interview Questions

7,069

software testing interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

20 Feb 2011

1 Apr 2010

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

12 Jul 2012
 Data structures and Algorithms related2 AnswersIam readyplz tell me which type of question put up in interview

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

26 May 2013
 Consider a stack of N number of cards which are piled up and in facing down. Each card has a unique number from the range 1 to N. The card is stacked in such a way that it exhibits the following behavior: Take the first card and put it under the stack without revealing. Now the next card on the top will have the number 1 on it. Next take 2 cards one after the other and put is under the stack without revealing. Yes you guessed it right - the next card on the top will reveal a value of 2. This goes on. Eg. for such a series : 9,1,8,5,2,4,7,6,3,10 [for N=10] Write a program to generate such a series for a given N number of cards so that this behavior can be exercised.8 AnswersPossible implementation in C++ -------------------------------------------------- int CounterStep(int counter,int N); int LocatePosition(int *cards,int N, int startPointer,int value); using namespace std; void main() { int cards[20]; int N=20; int POS = 0,TOP = 0; // Initializing everything to zero for(int i=0;iWritten in Python although it can be re-written in C/C++ if required. def generateSpecialSeries(numberOfCards): specialSeries = [] if numberOfCards > 0: for i in range(numberOfCards, 0, -1): specialSeries.append(i) currentSpecialElement = 1 currentIndex = 1 while currentIndex < numberOfCards: indexOfCurrentSpecialElement = numberOfCards - currentSpecialElement specialSeries[currentIndex], specialSeries[indexOfCurrentSpecialElement] = specialSeries[indexOfCurrentSpecialElement], specialSeries[currentIndex] currentSpecialElement += 1 currentIndex += currentSpecialElement + 1 return specialSeries specialSeries = generateSpecialSeries(50) print specialSeries specialElement = 1 specialElementSum = 1 currentIndex = 1 while currentIndex < 50: print specialSeries[currentIndex] == specialElement specialElement += 1 specialElementSum += specialElement currentIndex += specialElement + 1// Short and simple C++ algorithm #define N 10 void compute(int stack[]) // Make sure N elements are allocated { int j=0; for(int i=0; iShow more responses#include using namespace std; int main(int argc,char **argv){ int count=20; int array[20]; for(int i=0;i>a; return 0; }Java implementation public class App { public static void main(String[] args) { String arr[] = new String[10]; int pointer = 0; for (int valueToPlace = 1; valueToPlace <= arr.length; valueToPlace++) { for (int x = 1; x <= valueToPlace; x++) { if (pointer == arr.length - 1) pointer = 0; else pointer++; if (arr[pointer] != null) x--; } System.out.println("Placing " + valueToPlace + " at index " + pointer); arr[pointer] = valueToPlace + ""; while (arr[pointer] != null && valueToPlace != arr.length) { if (pointer == arr.length - 1) pointer = 0; else pointer++; } } for (String str : arr) { System.out.print(str + ", "); } } }The algorithm used is: For each number n (ranging from 1 to 10), we have to skip n places in the array. And then put number n at that position. The catch in the program is that we can skip only, not occupied places (the array places where value is 0 by default). Also, when we reach the end of the array, we have to move back to beginning of array (similar to cards being kept at the bottom of the pile of cards.) Here, a variable 'pos' is used to store the final position of any element. Initially, pos is at 0. The skip() takes the array, the current value of pos and the number of skips to be made. For example, for n=1, the values passed to skip() would be: pos=0, n=1. This means that we have to skip 1 place starting from index 0. Similarly, for n=2, pos=1. This means we have to skip 2 places starting from index 1. Java Implementation: public class StackOfCards { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = new int[10]; int pos=0; for(int n=1;n0){ if(arr[pos]==0){ //reduce the number of skips to be made n--; } pos++; //if end of array is reached, take pos back to beginning if(pos==10){ pos=0; } } // keep incrementing pos until a not occupied index is reached. while(arr[pos]!=0){ pos++; } return pos; } }Here is C# Code... namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int n = 36; int[] series = new int[n]; int LargestNumber = n; int SmallestNumber = 1, temp = 1, i; bool putLargeNumber = true; for (i= 0; i 0)) { series[i] = LargestNumber; Console.Write("{0} ", series[i]); LargestNumber = LargestNumber - 1; putLargeNumber = false; temp--; } else { series[i] = SmallestNumber; Console.Write("{0} ", series[i]); SmallestNumber += 1; putLargeNumber = true; temp = SmallestNumber; } } } } }import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Stack; public class MSQuestion1 { static int counter =1; public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n =in.nextInt(); // x 1 x1 x2 2 x3 x4 x5 3 x6 int[] arr = new int[n]; int f = 0; while(f0)) { arr[f]=counter; counter++; } f++; } for(int i=0;i

### Test Automation Engineer at Oracle was asked...

28 Mar 2018
 Sort Binary Arrays - {0,1,0,1,1,1,0,0,0,1}7 Answerspublic static void SortBinaryArrays(int[] Binary) { int[] sorrtedArray = new int[Binary.length]; int i = 0; for (int a : Binary) { if (a == 0) { sorrtedArray[i] = a; i++; } } for (int a : Binary) { if (a == 1) { sorrtedArray[i] = a; i++; } } for (int a : sorrtedArray) { System.out.print(a + " "); } }int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftShow more responsespublic static void main(String[] args) { int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftpublic static void main(String[] args) { int [] a= {1,0,1,0,1,1,1,0,0,0}; int [] arr= new int[a.length]; int left=0; int right=a.length-1; while (leftint[] a={0,1,0,1,1,1,0,0,0,1}; int index=0; public static int[] sortBinaryArray(int[] a) { for(int i=0;ipublic static int[] sortBinaryArray(int[] a) { int leftptr=0; int rightptr=a.length-1; while(true) { while(a[leftptr]==0) { leftptr++; } while(a[rightptr]==1) { rightptr--; } if(leftptr One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Associate Test Engineer at UnitedHealth Group was asked...

28 Sep 2013
 The most surprising part was that i was even asked questions about the basic electronics in the interview round as my branch was ECE... 6 AnswersIn the aptitude round... we had two cut-offs.. one was sectional and the other was overall cut off. For this post be thoroughly prepared with C, C++, sql, DBMS, puzzlesHi... i want to know about the date of this interview, and how much time they take to give response after HR round??This was interview was held on 22nd September,2013. They took about 3 days after the HR round to respond back.Show more responsesThanks..i also gave hr interview on 22sep but havn't received their call till now. Does thi mean i am not selected??? or they will call me for 2nd batch after sometime??? any idea??No idea...

4 Feb 2015

### Test Engineer at Amdocs was asked...

8 Sep 2012
 unix questions were difficult.....sql was easy....choose your skill carefully...i choose c so they asked only c questions....2 Answerswhat is my question ?What type of questions on C? I too chose C. Im expecting a technical / PI call for 2 months now...I cleared written on 22 September :( still no clue about Tech/PI frm dem...

### Test Automation Engineer at Oracle was asked...

7 Feb 2019
 String Palindrom, reverse words in a string, find longest substring in a string, duplicate characters in a string and print the count of it.5 Answerspublic static boolean isPalindrome(String string) { String reverse =""; for(int i=string.length()-1;i>=0;i--) { reverse=reverse+string.charAt(i); } if(string.equalsIgnoreCase(reverse) { return true; } return false; }//* Using stack public static boolean isPalindrome(String string) { String rev=""; Stack stack = new Stack(); for(int i=0;i//Reverse Words In a String public static String reverseWords(String s) { String res=""; String[] string=s.split(" "); for(int i=0;i=0;i--) { rev=rev+string.charAt(i); } return rev; }Show more responses//*Counting duplicates public static int countDuplicates(String str) { char[] charArray = str.toCharArray(); Map hash_map = new HashMap(); for(int i=0;i entry:hash_map.entrySet()) { if(entry.getValue()>1) { count=count+1; } } return count; }//Reverse Words in String public static String reverseWords(String string){ String[] stAr=string.split(" "); String result=""; for(int i=stAr.length-1;i>=0;i--) { result=result+" "+stAr[i]; } return result.subString(1,result.length()); }

### Automation Test Engineer at Oracle was asked...

13 Feb 2016
 Code to find a missing number in an array5 Answerspublic void missing() { ArrayList arr = new ArrayList(); int a[] = { 1, 3, 4, 5, 6, 7, 10 }; int j = a[0]; for (int i = 0; i < a.length; i++) { if (j == a[i]) { j++; continue; } else { arr.add(j); i--; j++; } } System.out.println("missing numbers are "); for (int r : arr) { System.out.println(" " + r); } }Does the numbes in an array lies in between a specific range ?Does the numbes in an array lies in between a specific range ?Show more responsesDoes the numbes in an array lies in between a specific range ?public static int findMissingNumber(int[] a) { int n=a.length; int expectedNumber=n*(n+1)/2; int actualsum=0; for(int i=0;i
110 of 7,069 Interview Questions