Nobody would come out and ask your caste directly. Most often what tends to happen is they infer your caste based on your surname, or ask you innocent-seeming questions such as: where is your family from, what does your father do, are you vegetarian by birth, etc.
The most roundabout way to determine one's caste that I have come across is inviting someone to swim. Brahmins, the upper-caste Hindus, traditionally wear a thread[1] which is on display when you swim. The ones who don't wear a thread are assumed to be non-Brahmin.
Anyway, once the caste is known subtle discrimination may follow (depending on the people of course).
The most roundabout way to determine one's caste that I have come across is inviting someone to swim. Brahmins, the upper-caste Hindus, traditionally wear a thread[1] which is on display when you swim. The ones who don't wear a thread are assumed to be non-Brahmin.
Anyway, once the caste is known subtle discrimination may follow (depending on the people of course).
[1] - https://en.wikipedia.org/wiki/Upanayana