IBM Interview Question

Two coding questions were asked