Both code snippet will yield the same result output. This is because we are arranging by country, year, sex and age in both cases. The 4:6 and child:elderly portion will pick based on column indexes or column names. Post that reshaping by arrange() will provide in desired / expected organized fashion. This, along with other basic R interview questions for freshers, is a regular feature in R programming interviews, be ready to tackle it with the approach mentioned.