Cognizant Interview Question

how would you do this and this.