Tech Mahindra Interview Question

Gave some scenarios and asked for a solution