Moody's interview question

Basic oops and dbms questions