solved questions 3 and 4 from arrays and strings