Unthinkable interview question

Basic array and DBMS queries