1. Tell me about your day to day activities.
2. Write code to calculate the factorial of any input number
E.g n!=n x (n-1) x (n-2) x.... x 1
5!=5x4x3x2x1 = 120
Solved it using integer. Then asked me do the factorial of 100. The result was 0.
Ques: Do you know why it is 0?
Ans: I solved it using int. Factorial of 100 is more than max value of int. Need to use different data type like float, double.
3. /* You are given two integer lists nums1 and nums2. Merge nums1 and nums2 into a single list sorted in descending order.
list1=[3,9,5]
list2 = [6,1,4]
expected o/p = [9,6,5,4,3,1]
Solved it using list.addAll() and then Collections.reverseOrder().
Follow up: Is there a better way to add the values in a list?
Yes, taking an array and then put everything from array to the list.
Follow up: If you have duplicates and I want to remove the duplicates, and then sort in descending order, how can I do that?
Ans: I will use a TreeSet. Add all elements of the lists to set. And then reverse it using Collections.reverse() method.
4. Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:
FirstName, LastName, City, State
Person Table:
+-------------+----------------+
| Column Name | Type |
+-------------+----------------+
| PersonId | int |
| FirstName | varchar |
| LastName | varchar |
+-------------+-----------------+
PersonId is the primary key column for this table.
Address Table:
+-------------+----------------+
| Column Name | Type |
+-------------+----------------+
| AddressId | int |
| PersonId | int |
| City | varchar |
| State | varchar |
+-------------+---------+
AddressId is the primary key column for this table.
5. What types of frameworks did you use for UI? Explain the design you followed.
Explained framework using POM.
6. Explain your design pattern of API framework.
7. What’s the difference between POST and PUT?
8. What types of authentications have you used?
9. What’s the difference between 401 and 403?
10. When you get a 400 in a POST call, what do you check first?
11. What are the different types of exceptions you handled in selenium?
Explained noSuchElementFound exception and different types of waits including Thread.sleep(), implicitWait, WebDriverWait() with expected condition.
12. How do you handle state element exception?
I know we are already running over time, but I have a few questions if you have some time.
1. What are the challenges you face day to day in this job?
Interviewer: we have a lot of test cases. We are using Java, Selenium for automation. I won’t say it is a challenge. But now we want to do a lot of API testing and unit testing i.e. shift left in addition to UI tests.
Me: That’s really a great approach. This is the testing strategy I follow. I use the strategic test pyramid approach. About 60-70% tests should be covered in unit testing. Then 20-25% in API testing as it is really fast to run. Core business logics should be tested via API. I have 1400+ test cases which take just 6min to run in pipeline. Only about 5% test cases should be automated in UI specially which are not testable via API, and end-to-end test cases. Cause a sing UI test case can take as much as 10min to run which is very costly to maintain.
2. What are the next steps in the hiring process?