If I get a question in the exam that shows any transformation, and then asks me to find the "2 x 2 matrix which represents the transformation", how would I find it? Is this a case of memorizing specific matrices?

Here's a real question from a past paper:

(a) Describe fully the single transformation which maps triangle A onto triangle B.

Rotation, y = x

(b) Find the 2 × 2 matrix which represents this transformation.