They must do this within reasonable time, at no additional cost to you and without causing any significant inconvenience.
If any inconvenience is caused you should be given a replacement item on a ‘like for like’ basis (and not simply the cheapest and most basic model).
For most things, shops would usually allow you to exchange the item or give you your money back straight away.
However, if the damage is minor and can be repaired easily, then the shop can insist on this as a first option, although this will not stop you from taking it back if the repair is unsatisfactory or there is something else wrong with it.
I got a quotation for the amount of £235 for payment for a replacement motherboard, heat sink fan and CPU (which had all become faulty), plus labour, shipping and VAT.