HCLTech interview question

Java core usual question and 2 problems