DXC Technology interview question

Basic codes about strings and arrays. Also some logics