Oh, I have had occasion as a priest to ask an adult if they are Catholic because they seemed clueless. I have had occasion to ask a child if they have received their First Communion because they are visitors unknown to me and of a height and other circumstance where they could have or not.
It is not possible, however, to interrogate a person…when they last went to Confession and such things. The canon quoted above, together with surrounding canons, delineates the matter. Once I know they are Catholic and that they are seeking the sacrament, the reasons for denying the sacrament are very strict.
Which, again, is why the diocese should be informed of what the priest said and did.