# Testing Engineer Interview Questions

Testing engineer interview questions shared by candidates

## Top Interview Questions

You have seven stones and a weighing scale. Six of the stones are equal in weight and one is lighter. How will you figure out which one is lighter ? Minimum tries required to do so ? 5 AnswersTrail 1: At random weigh two stones vs. two stones (3 sitting on the side) A: Of the 4 on the scales if one side weighs more then the other then weigh one on each side (since one of them must be heavier) B. If the 2 vs 2 are equal then at random weigh 2 (one on each side) of the three left on the side. If they are the same then the 3rd one that never got weighed is the heaviest. Simple case of process of elimination by grouping (Divide and Test) I would first weigh in one stone, say stone 1, and assume the weight is say 2 lbs(try 1). Then separate the 6 remaining stones into 2 piles, 2,3,4 and 5,6,7. Weigh in either 2,3,4 or 5,6,7, it doesn't matter. Say 2,3,4, if the sum of these 3 is 6 then the lighter stone has to be in the 5,6,7(try 2). Weigh in 5,6, if the sum of the two is 4 then the lighter is stone 7(try3). If sum is less than 4 then weigh in either 5 or 6 to find out. So, the maximum number of tries is 4 and least is 3. Needs two weighing at most: 1. Put {1, 2, 3} on LHS and {4, 5, 6} on RHS. 2. If LHS and RHS are equal 7 is the lighter one. else discard heavier of previously weighed group. Now we have a group 3 stones left. Lets call them A, B, C. 3. Put A on LHS and B on RHS. 4. If LHS and RHS are equal C is the lighter one. else lighter or LHS or RHS is the lighter one. Voila! Show More Responses Two tries. 1st try: 3 : 3, 7th is fake if equal; otherwise, 2nd try: 1:1 picked from the light triple in 1st try. the lighter one is fake if any, the third one fake otherwise. If the stones are made of the same material... they likely have the same density... therefor whichever one looks the smallest, will weigh the least... there... 1 step... just look for the one that is the smallest. |

First explain what a tree, then binary tree, then a binary search tree is. Now implement a function that verifies whether a binary tree is a valid binary search tree. 5 AnswersSadly I ran out of time for this question. But I e-mailed the response after my time was up. First create a small implementation of a binary tree, I did it in java with the standard implementation Nodes with left and right children as data points. Check whether the left child and right child have valid values, which is to say make sure all children on the right of a node have values greater than parents that they came from. The key thing that I missed during the interview was the fact that if you traverse once to the right, then once to the left, you have to make sure the value is between the max and min that you've encountered up to that point. int validate_BST(struct tnode *tree){ int ret1, ret2; if (tree == NULL) return 1; else { if (tree->left != NULL){ if (tree->data > tree-left->data){ ret1 = validate_BSR(tree->left); } else return 0; } if (tree->right != NULL) { if (tree->data right->data){ ret2 = vaidate_BSD(tree->right); } else return 0; } return (ret1 == 1 && ret2 == 1)? 1: 0; } return 0; } To find whether a binary tree is valid Binary search tree, do inorder traversal and check if the nodes are sorted. Show More Responses private boolean isBST(){ return isBST(root, Integer.MIN_VALUE, Integer.MAX_VALUE); } private boolean isBST(Node node, int min, int max){ if(node == null) return true; if(node.data max) return false; else return (isBST(node.left, min, node.data) && isBST(node.right, node.data+1, max)); } In order to verify the Binary Search Tree, Read the nodes in Inorder mode. Also at every step check if the current node value is less than the one previously found then exit the traversal as the items are not sorted. |

I was asked a pretty straight forward brain teaser during my last phone interview, which they said they don't normally do, but because I put that I was a logical problem solver on my resume they couldn't resist the opportunity to. It was the following "There are 20 different socks of two types in a drawer in a completely dark room. What is the minimum number of socks you should grab to ensure you have a matching pair?" 9 Answers3 is the answer when the probability is 50% for either color. "20 DIFFERENT socks of two type" In my opinion It's a brain teaser not a probability question. The answer is none. There is no sock alike, so you can't get a pair. 3 is the answer no matter what... there are only 2 types, if you grab 3, you must have 1 of one type and 2 of the other Show More Responses I'm not a mathematician, statistician or highly analytical but if you pick up 3 socks they could still be all the same type - even if the odds are 50%. Odds do not equal reality. So the only way to "ensure you have a matching pair"is to pick up 11 of the 20. This is the only fool proof guaranteed way to get a pair (in the real world and not the world of odds). All of the previous answers are somehow wrong or misleading. "Not-a-mathematician": the method you describe would ensure that you get 2 DIFFERENT socks instead of matching - and only in the situation that the ratio is exactly 50-50. "Anonymous on Oct 20 2012": No, you could also have 3 of the same sock after grabbing 3. "Anonymous on Oct 3": The probability has little to do here, while it is over 0%. THE REAL ANSWER: Given that there are 2 types, and you want to get a MATCHING PAIR (not 2 different socks) you must grab 3. When you have 3, you WILL have at least 2 of the same kind, since there are only 2 kinds available. Easy. I do this every morning when I get up. The answer is ONE PAIR. If you are like most people and have rolled the socks together in pairs when you put them away, there is no guessing and you just grab a pair of socks. I think it's more of a question about habits and prep. ;) It says "ensure" you have a pair. So all the probability answers are dead wrong. The person who said "The answer is none. There is no sock alike, so you can't get a pair" is probably correct. However if the question is to get two of the same type (of which there are two), then the only correct answer is 11. That is the MINIMUM number to ENSURE you have a pair--all probability aside. It says "ensure" you have a pair. So all the probability answers are dead wrong. The person who said "The answer is none. There is no sock alike, so you can't get a pair" is probably correct. However if the question is to get two of the same type (of which there are two), then the only correct answer is 11. That is the MINIMUM number to ENSURE you have a pair--all probability aside. It doesn't tell you that there are 10 and 10. There could be 19 and 1. But regardless: There IS a way to grab 2 socks and not have 2 that match. (one of each) But there is NO WAY to grab three socks and not have 2 of them match. |

### Test Engineer at Qualcomm was asked...

Talk about how to verify if an RF amplifier is operating in its linear mode? 4 AnswersObserve the IM3. Back off input by 1dB and see how much IM3 changes. hi, did you applied for system test engineer? If yes, can I ask some detailed question? Thank you! Yes. Show More Responses hi, can you send me your email address? Mine is dayuallen@gmail.com, thank you. |

find if 2 strings are anagrams 5 Answershash Hash what, lol ? :))) You simply need to alphabetically sort characters in strings and then compare the result. think about the time complexity. Whats the time complexity of the sorting? NlogN And when using hash mapping, it can be only N. Mapping the string to an alphabet array, the index is the char and the value stores the frequency of the char. Hope it helps. Show More Responses easiest way probably to reduce the characters to ascii, add them all together. If values are equal, they all contain the same characters. O(n) Just reverse one string and then compare the result with other string. |

Given a triangle, determine if its a scalene, equilateral, isosceles or neither... required knowledge of triangle properties, I learnt these properties about two decades ago so ofcourse I was fuzzy on the details, completely unexpected 4 Answerstesting use of ==, got a feeling he wanted to use bit level comparisons to compare sides lengths If the sides are all integers, then compare the length^2 instead of length to avoid the floating comparison; If the sides are floating numbers, then we need to set an epsilon to test. You'd better ask the interviewer about this. Asking this will definitely gives the interviewer better impression.... I believe :-) BTW, if you are given the sides instead of points, the condition to make an triangle is: a+b > c && b+c > a && c+a > b Show More Responses /* Q: Given a, b, c, determine if it can be the 3 sides of triangles, if yes determine if it's equilateral, isosceles, or scalene. */ #include #include #include using namespace std; // Use this in real world typedef enum { NONE = 0, EQUILATERAL = 1, ISOCELES = 2, SCALENE = 3 } TriangleType; double Epsilon = 1.0E-6; string GetTriangleType(double a, double b, double c) { if (a+b > c && b+c > a && c+a > b) { bool ab = (fabs(a-b) < Epsilon); bool bc = (fabs(b-c) < Epsilon); bool ca = (fabs(c-a) < Epsilon); if (ab && bc && ca) return "Equilateral"; if (ab || bc || ca) return "Isoceles"; return "Scalene"; } else { return "None"; } } int main() { cout << GetTriangleType(3, 3, 3) << endl; cout << GetTriangleType(3, 3, 5) << endl; cout << GetTriangleType(3, 4, 5) << endl; cout << GetTriangleType(3, 4, 7) << endl; return 0; } /* Output: Equilateral Isoceles Scalene None */ |

given two linked lists with a digit in each node, add the two linked lists together. the result must be a linked list with one digit in each node. use only one iteration of the two input lists. 5 AnswersIs this to remove duplicates from linked list or just combining both the linked lists blindly? assume the numbers you need to add are 560 and 890. the result should be 1450. so linked list A will have 5 -> 6 -> 0 and linked list B will have 8 -> 9 -> 0 so you must add them together to produce 1 -> 4 -> 5 -> 0. i believe the reason for an algorithm like this is to have a method of adding arbitrarily large numbers together. rather than storing an integer as int32 or int64, we can store the int as a linked list, which can be any size integer we want. Of course, the underlying 'int' we use for the data of the linked list only needs to be 4 bits to cover 0-9 in decimal. public static List AddTwoLists(List first, List second) { return first.Zip(second, (a, b) => a + b).ToList(); } Show More Responses i don't believe this answer is correct. you must account for cases where you will carry a 1. for example, if node A_i is 5 and node B_i is 7, then C_i = 2 and C_(i-1) = C_(i-1) + 1. In short, you must consider the carry value. I don't see that your solution considers this. Your solution would make C_i = 12, but 12 is two digits, not one. I think the answer should traverse both link lists and add each node data and make a new link list with digit on each node of the answer. In this way we can traverse in N time and at the end if any nodes are left in second link list we can attach them at the end of new link list |

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 Answers100 - 1 = 99 days This question is phrased incorrectly. I think you meant "4 units after 3 days". Which makes your answer wrong as well. This is not helpful at all. if you start with 1sq unit - lets say you end up with 'x' amount to fill up - takes 100 days if you start with 2 sq unit - you will have to fill up '2x' amount thus it will take - 200 days. Show More Responses Starting with 2 square units at time t=0 is like 1 square unit at t = 1. [this logic is the key to answering the question]. Now let's do the first few cases. t = 0: size = 1+1 = 2 t = 1: size = 2(1+1) = 2+2 = 4 = f(2) in the 1 unit case. Pretty easy to see it only requires 1 time period less from here. The OP was right. 1 day less that is 99 days. It is still 100 days. Starting from 2^0, and going all the way to 2^100, the reservoir has a capacity of 2^101 - 1 units. Now in the second case, starting from 2^1, in 99 days there will be 2^101-2 units of water in the reservoir, which is one unit short of the capacity of the reservoir. So we need the 100th day to fill it up! |

### Test Engineer at Broadcom was asked...

Given Vcc and 2 capacitors A and B in series to ground, what is the voltage in between 4 AnswersSomewhere in between Vb=(Cb/Ca+Cb)V I mean Vb=(Cb/(Ca+Cb))V Show More Responses It depends on the initial condition.... if both capacitors were discharged to 0V at first, and then one side is charged to Vcc, then the answer would be Vb=(Ca/(Ca+Cb))Vcc Vcc---Ca----Cb----gnd However since there was no initial conditions given , the middle voltage could be anything if the capacitors are ideal |

What is a class? 4 AnswersJust because you have years of programming experience, doesn't mean you won’t be asked entry-level question. Prepare for this. This is a reasonable question for a senior person - you should be able to explain basics to a client, manager or junior person. So a answer could be: A class is a group of objects with shared properties. Using classes reduces time needed for new coding and simplifies changes. Take responsibility for your actions. For someone with that much experience, you can't answer this stupid question? I do interviews and hires and if you gave me that lame excuse, I would terminate the interview on the spot. Every resume I look at looks the same (same experience, job titles, job responsibility). You need to make the difference in the interview, this is what distinguish you from the other 100 candidates. Hate to say it but, with the economy the way it is, it is easier to be choosy on who I hire. Show More Responses This guy (interview candidate) is hilarious, those three questions are the most fundamental concept of OOP, and he consider OOP entry-level? LOL. What have you done at Microsoft? Non-programming related job? Go back to any college and take a CIS 200 level class. Experience at Microsoft is not a pass for interview questions. |

**21**–

**30**of

**3,257**Interview Questions

## See Interview Questions for Similar Jobs

- Healthcare
- Hospitality
- Pharmaceutical Sales
- Cashier
- Social Worker
- Pharmacy Technician
- Marketing
- IT
- Account Executive
- Accountant
- Engineering
- Truck Driver