Bitwise Interview Question

Questions on programming logics and also queries on database