Location : India
Screening Test details for Rain Instant Pay
90 mins duration
total 3 tasks
Golang and SQL only lang options
Task 1 :
As part of question a faulty code of find_min in an array was given.
code (approx)
result := 0
for int i=0; i<len(A); i++ {
if(result > A[i])
result = A[i];
}
return resultNow as a part of task you have to write an algorithm which will generate a counter example array that will prove above code wrong. N is given as part of input to the array
For Example :
Input N=5
Output : [4,2,4,3,4]
Explanation : answer should be 2 for above array but faulty code will return ans as zero
Task 2 :
Given an array of integers, return minimum positive integer that is not present in input array. (duplicates allowed)
array elements are in range [-1000000,1000000]
For Example :
Input N=[1,4,2,1,5]
Output : 3
Explanation : smallest positive integer is 3 which is not present in array
Input N=[-100,5,2]
Output : 1
Input N=[3,2,1]
Output : 4
Task 3 :
2 relational tables were given
testgroups(name,marks) - contains test groups and marks awarded for each passing testcase of this group
testcases(id,groupname,status) - contains result of testcases executed where status can be OK or FAILURE
You have to write an SQL query which will generate output of the form
(group-name, total-testcases, passed-testcases, score)
For Example :
testgroups
| name | marks |
|---|---|
| g1 | 20 |
| g2 | 10 |
| g3 | 15 |
| g4 | 10 |
testcases
| id | name | status |
|---|---|---|
| 1 | g1 | OK |
| 2 | g2 | OK |
| 3 | g1 | OK |
| 4 | g3 | FAILURE |
| 5 | g2 | FAILURE |
| 6 | g1 | OK |
| 7 | g1 | OK |
| 8 | g3 | FAILURE |
| 9 | g2 | OK |
ans
| name | tatal testcases | success testcases | score |
|---|---|---|---|
| g1 | 4 | 4 | 80 |
| g2 | 3 | 2 | 20 |
| g3 | 2 | 0 | 0 |
| g4 | 0 | 0 | 0 |