# Questions d'entretiens - Software quality engineer

# 3 k

Questions d'entretien pour Software Quality Engineer partagées par les candidats## Principales questions d'entretien

### There are three boxes, one contains only apples, one contains only oranges, and one contains both apples and oranges. The boxes have been incorrectly labeled such that no label identifies the actual contents of the box it labels. Opening just one box, and without looking in the box, you take out one piece of fruit. By looking at the fruit, how can you immediately label all of the boxes correctly?

46 réponses↳

Swaz answer is almost correct however it does not work in all scenarios. lets assume: box 1 is labelled Oranges (O) box 2 is labelled Apples (A) box 3 is labelled Apples and Oranges (A+O) and that ALL THREE BOXES ARE LABELLED INCORRECTLY" Pick a fruit from box 1, 1) if you pick an Orange: - box 1's real label can only be O or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - box 1's new label should then be A+O by elimination - since ALL LABELS ARE INCORRECT - box 2's label is changed to O - box 3's label is changed to A - SOLVED 2) if you pick an Apple: - box 1's real label can only be A or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - this still leaves us with the choice between label A and label A+O - which would both be correct - FAILURE Solution: The trick is to actually pick a fruit from the A+O labeled box Pick a fruit from box 3: 1) if you pick an Orange: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be O by elimination - since ALL LABELS ARE INCORRECT - box 1's label is changed to A - box 2's label is changed to A+O - SOLVED 2) if you pick an Apple: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be A by elimination (not O) - since ALL LABELS ARE INCORRECT - box 1's label is changed to A+O - box 2's label is changed to O - SOLVED Moins

↳

All the three boxes are names incorrectly. SO the bax lebeled Apples+Oranges contains only Oranges or Only Apples. Pick one fruit from it. If it is Orange then lebel the box as Orange. So the box lebeled Oranges contains Apples and the remaining contains both. Moins

↳

It's easier to draw it out. There are only 2 possible combinations when all labels are tagged incorrectly. All you need to do is pick one fruit from the one marked "Apples + Oranges". If it's Apple, then change "Apple + Orange" to "Apple" The "Apple" one change to "Orange" The "Orange one change to "Apple + Orange" If it's Orange, then change "Apple + Orange" to "Orange" The "Apple" one change to "Apple + Orange" The "Orange" one change to ""Apple" Moins

### Give an array of Integer which contain duplicate number from 1-100, how to count how many distinct number you have?

6 réponses↳

HashSet hs= new HashSet(); for (Integer x: inputArray){ hs.add(x); } s.o.p(hs.size()); Moins

↳

Hi Hiten, the answer should return 9 instead of 7, cuz you want to find the distinct number, this hashset should have 1,2,3,4,6,7,8,9,0, which have 9 elements inside Moins

↳

number of distinct integers in array = number of integers in array - number of duplicate integers number of integers in array = length of array So, this becomes a problem of finding the number of duplicates. This can be accomplished in O(N) time using the following algo: public static void countDistinct(int[] arr){ //numbers are b/w 1-100 boolean[] hit = new boolean[100]; int dup = 0; for(int i=0;i Moins

### You have five bottles with pills. One bottle has 9 gram pills, the others have 10 gram pills. You have a scale that can only be used once. How can you find out which bottle contains the 9 gram pills?

5 réponses↳

Number the bottles 1-5. Collect a number of pills from each bottle corresponding to their bottle number. So, 1 pill from bottle 1, 2 from bottle 2, etc. If they all had 10 gram pills they should weigh 150 grams. The difference will be the number of the bottle the 9 gram pill came from. Example, bottle 3 has the 9 gram pills. Total weight read will be 147 grams. The difference of 3 is the bottle it came from. Moins

↳

Read the label on the bottle.

↳

What top poster said except you can label the bottles from 0 to 4 and save yourself a little work Moins

### how to find the closest 2 number in an array of unique positive number

5 réponses↳

One solution is to sort the array, then iterate through all neighboring pairs to find the pair with smallest difference. This is O(NlogN) solution. If the integers are bounded, you may be able to sort in O(N) time for an O(N) solution. Moins

↳

public static int[] find2Closest(int[] myArray) { assert(myArray.length >= 2): "myArray needs to be larger than 2"; Arrays.sort(myArray); //quickSort int indexMin1 = 0; int indexMin2 = 1; int min = myArray[indexMin1] - myArray[indexMin2]; for(int k = 0; k < myArray.length-1; k++) { int difference = Math.abs(myArray[k] - myArray[k+1]); if(difference < min) { min = difference; indexMin1 = k; indexMin2 = k+1; } } int[] values = new int[2]; values[0] = myArray[indexMin1]; values[1] = myArray[indexMin2]; return values; } Moins

↳

public class ClosestTwoNumber { public int[] findClosest2Number(int[] arr){ if(arr == null || arr.length diff) { min = diff; num1 = arr[i - 1]; num2 = arr[i]; } } if (num1 == -1 || num2 == -1) { throw new IllegalArgumentException(); } int[] result = new int[2]; result[0] = num1; result[1] = num2; return result; } Moins

### how to test a toaster?

5 réponses↳

I would find a tester and I'd tell him/her to test the toaster by plugging it in. If the toaster doesn't toast the tester, it works; if it toasts the tester, it's broken. Moins

↳

He means "if you don't get electrocuted then the toaster works. If you die of electrocution then the toaster is broken" lol Moins

↳

Contined...prior to lowering the bread into the toaster select the lowest heat setting. Once the bread is lowered set a timer to measure length of time before toast cycle completes and toasted bread pops up. Retest on all other heat settings and time each of these. Moins

### read in a string and output it backwards

5 réponses↳

public void (String input) { if (input == null || input.length == 0) return; for (int i = input.length-1; i >= 0; i--) { System.out.print(input.charAt(i)); } System.out.println(); } Moins

↳

public static void main(String [] args) { String a = "qwerty", rev = ""; //Scanner sc = new Scanner(System.in); //System.out.println("Enter the string : "); //String a = sc.nextLine(); for(int i = a.length()-1; i >= 0; i --) { rev = rev + a.charAt(i); } System.out.println(rev); } Moins

↳

myString[::-1]

### Interview questions: recursion, probability

4 réponses↳

Thanks a lot. Really appreciate it. Can you be please more specific about onsite questions they were asked. That would immensly help me ! Moins

↳

Yes, it would be really helpful if you could give the topics or questions of the technical rounds of the interview Moins

↳

It was from around 10am to around 3-4pm, many 1:1 interviews with other team members, team leader, HR, and other people in the company. Interview with team members and the team leader was mostly technical to see how smart you are, how fast/well you can code, and other questions related to the position. Interview with HR, and other people in the company was just general, introduce you to the company's business, what they do. And the purpose was, I think, to see how you like and fit in the company's culture. Moins

### The brain teaser: what is the last digit of 2007 power 2007

4 réponses↳

Last digit of 7^1 is 7. last digit of 7^2 is 9. Last digit of 7^3 is 3. Last digit of 7^4 is 1. After this, the last digits repeat in the same pattern. 2007 divided by 4 is 501 with reminder is 3. Therefore the last digit is not 7, not 9, but 3. (the third case). Moins

↳

Answer: Concept: for n^n multiple resultant number in units place n-1 times with n. Answer: Just multiply the units place of the result wit 7 , six times.. i.e 1st iteration- 7 x 7 = 49 take number in units place i.e 9 mul by 7--> 2nd iteration- 9 x 7 = 63 3rd iteration- 3 x 7=21 4th iteration- 1 x 7=7 5th iteration- 7x7=49 6th iteration- 9 x 7=63 Note we have to take only 6 iterations because we have already considered 7 twice in the first iteration. i.e 7 multiplied by SIX 7s So the digit would be 3. Moins

↳

simple solution is : 7^1 = 7 7^2 = 9 7^3 = 3 7^4 = 1 7^5 = 7 7^6 = 9 7^7 = 3 7^8 = 1 so pattern follows in 4 part so 2007 mod 4 = 3 so Third pattern answer is 3 Moins

### test life cycle in assurance

4 réponses↳

explained all phases of test lifecycle

↳

Software Testing Life Cycle 1.Requirment analysis 2.Test planning 3.Test Designing/Test case development 4.Environment setup 5.Test Execution 7.Test cycle closure/Test reporting Moins

↳

Software Testing Life Cycle 1.Requirment analysis 2.Test planning 3.Test Designing/Test case development 4.Environment setup 5.Test Execution 7.Test cycle closure/Test reporting Moins

### Why do you want to work for Apple

3 réponses↳

I like it.Hahaha

↳

because i cant get into google.

↳

Apple is quite known company, a lot of things I read or heard about it, but never experienced by myself. To work for Apple is a big honor and opportunity to develop my self. Also to exercise myself, what can I do to reach goals and just enjoy to work Moins