Marlabs interview question

Very basic core Java questions and one simple algorithm question.