وَاسْأَلِ الْقَرْيَةَ
And ask the town.
The intended addressees are the inhabitants of the town. An underlying wording is “وَاسْأَلْ أَهْلَ الْقَرْيَةِ”, “ask the people of the town.” There “ahla” is the accusative object, and “al-qaryati” is its genitive complement.
After the omission of “ahl,” the expressed “al-qaryata” occupies the object position of the command “ask” and is accusative. Thus the passage illustrates a shift both in the understood relation to persons and in the syntactic case of the surviving noun.