Keyideas Infotech interview question

1st question was based on string. 2nd question was based on again string