Tech Mahindra interview question

String and array question and basics