Tech Mahindra interview question

Some brain teasers were tricky.