Cognizant Interview Question

Coding question on switch case and array