Afiniti interview question

1. 2nd Maximum Employee Salary -> SQL Tuples? -> Python // and % -> python Two Tables form 3rd using __ (INNER JOIN) (SQL) You have 8 balls, all of equal weight except one. You're given a scale, identify that anomaly ball in 2 or less tiers. 2. 75, 15, 25, 5, 15, ... (Next two numbers) Probability of 3 heads of 5 coins flipped in a go Name of employee with 4th lowest salary (SQL) List of employees with minimum 4th - 11th salaries (SQL) Pseudocode of Factorial of a number with a condition to place error for chars other than positive (or 0) input There's a wrongly wired (it's known) vending machine with Coffee, Tea and Random button (Random gives you either Coffee or Tea). If one button costs 50p, identify the correct buttons while using minimum money.

Interview Answer

Anonymous

15 Apr 2022

I actually liked these IQ question, whose answer is hard to guess at first. In first interview I first have thought of it as a bisection rule. But the answer was to select 6 ball at first and check what pair is heavy: 6 + 2 3*2 (if there's a difference) 2 + 1 1*2 (if there's a difference) In case there's no difference the solution is simple. In 2nd tier it'll be the one remaining, and in first test it on the remaining 2. For 2nd question that was relatively easy it was: R -> T, C (50p) Press the random button, and say it gives you Tea. So, this is a tea button. 1. So, Random -> tea Check coffee button, it cannot be tea or coffee 2. So, Coffee -> Random The third button would be 3. Tea -> Coffee You can do it in 1 tier with 50p