When are good situations to use the phrase "見事にやられた" ?
In the language guide book "Shadowing," the authors use it to refer to doing very badly on an exam.
Thank you.
You say "やられた!" when you acknowledge that you have been outsmarted, outperformed or outdone by someone. For example, when you lose a game or find yourself outmaneuvered by your opponent, you can say "やられた!" to admit defeat. Other situations in which you might say "やられた!" include when a competitor releases a new product that outperforms yours, when your rival solves a problem that you were struggling with, or when you're surprised by a prank. Adding 見事に ("excellently; neatly") as an intensifier emphasizes the extent of your defeat or surprise.
When you say "(見事に)やられた" after getting a bad score on a test, it implies something like "The teacher outsmarted/tricked me and gave me unexpected (yet reasonable) questions!"
EDIT: Grammatically, やられた is the (past) passive form of やる ("to do"), and this type of passive is called "suffering passive" (迷惑の受け身). The idea is someone did something and it negatively affected you.