It's legal here and I hate it when I get an answer wrong and the teacher goes 'whos paper do you have'
We had peer-marking at my school, but they never asked whose was whose in front of the class.
The point of the exercise was for you to see where other people are making mistakes too, and what you should avoid, as well as their strengths and what you should try.
And to get your work back with a peers marking and get a second opinion on your work besides your teachers.
However, we hardly ever had quizzes, and they were never peer-marked.
We only peer-marked essays, because that actually makes sense.