Senior test engineer Interview Questions | Glassdoor

Find jobs for senior test engineer

Senior test engineer Interview Questions

279

senior test engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Search a sorted array for the first element larger than k

8 Answers

Use binary search algorithm since array is sorted.

#!/usr/bin/env python """Search a sorted array for the first element larger than k. """ def srch(list1, srchItem): """Perform Binary search and find the first element that is larger than the arg srchItem @list1: The sorted list @srchItem: The element to be searched for finding next greater value than that """ len1 = len(list1) startIdx = 0 stopIdx = len1 - 1 stop = False # saveIdx the index of the lowest value in the sorted list saveIdx = -1 while not stop and startIdx >= 0 and stopIdx srchItem: # found greater item, but the previous one also could be greater stopIdx = midIdx - 1 saveIdx = midIdx elif list1[midIdx] srchItem: saveIdx = startIdx break elif startIdx >= len1 or stopIdx < 0: break if saveIdx == -1: return -1 # not found return list1[saveIdx] def testAll(): testList = [3, 6, 9, 34, 67] print 'Test: %s SrchItem: %d' %(testList, 34) print 'Result: %d' %srch(testList, 34) testList = [3, 6, 9, 34, 67, 69] print 'Test: %s SrchItem: %d' %(testList, 34) print 'Result: %d' %srch(testList, 34) # test for result to be the 1ast item in the list testList = [3, 6, 9, 34, 67, 69] print 'Test: %s SrchItem: %d' %(testList, 68) print 'Result: %d' %srch(testList, 68) # test for result to be the ist item in the list testList = [3, 6, 9, 34, 67, 69] print 'Test: %s SrchItem: %d' %(testList, 1) print 'Result: %d' %srch(testList, 1) # item not in the iist testList = [3, 6, 9, 34, 67, 69] print 'Test: %s SrchItem: %d' %(testList, 70) print 'Result: %d' %srch(testList, 70) if __name__ == '__main__': testAll()

//Run time complexity is logn public class FirstGreatestNumberThanK { public int prepareFirstGrtst(int[] a, int k) { return firstGrtst(a, 0, a.length - 1, k); } public int firstGrtst(int[] a, int start, int end, int k) { if (end == start + 1) { if (a[start] > k) return a[start]; else return a[end]; } else { int mid = (start + end) / 2; if (k == a[mid]) return a[mid + 1]; if (k > a[mid]) { start = mid; return firstGrtst(a, start, end, k); } else { end = mid; return firstGrtst(a, start, end, k); } } } public static void main( String[] args){ FirstGreatestNumberThanK f = new FirstGreatestNumberThanK(); // int[] a = {2,4,6,8,9,12,14,16}; // even length int[] a = {2,4,6,8,9,12,14}; // odd length // System.out.println(f.prepareFirstGrtst(a, 11)); // System.out.println(f.prepareFirstGrtst(a, 3)); // System.out.println(f.prepareFirstGrtst(a, 7)); // System.out.println(f.prepareFirstGrtst(a, 15)); // execute for even length data // System.out.println(f.prepareFirstGrtst(a, 14)); // execute for even length data // System.out.println(f.prepareFirstGrtst(a, 4)); System.out.println(f.prepareFirstGrtst(a, 12)); System.out.println(f.prepareFirstGrtst(a, 2)); } }

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

There is a body of water that starts with 1 square unit, and doubles in size every day (2 units after 2 days, 4 units after 4 days). It takes 100 days to fill up. How many days would it take to fill if you started with 2 square units?

6 Answers

Find indices start and end for a particular value in a sorted integer array with duplicates

3 Answers

Coding: Create a stack with the usual push() & pop(), but with an additional function getMiddle() that returns the middle element of the stack in constant time.

3 Answers

Couple of questions asked at the interview I could not get my head around and never expected in an interview in a company like Pearson which is internationally recognized. 1.You are just 2 years in United States and looking for a job change? 2.Why are you looking for a full time opportunity?(Seems the person did not read my resume carefully that I am full-time employee with Cognizant for more than 8 years now) These questions asked does not support the claim of Pearson that it is a equal opportunity employer.And proves there are discriminations made.

3 Answers

Write a program to remove vowels from a given string

2 Answers

What was one thing that someone said to you that stuck with you?

2 Answers

finad all plaindromes ina string.

2 Answers

Explain the significance of "dead beef"

1 Answer

The problem statement for the other coding interview was interesting since there was some level of detail but still had some ambiguity.

1 Answer
110 of 279 Interview Questions