Generally, the warranty includes that Apple will repair or replace the malfunctioning part(s). This is an excerpt from the US iMac hardware warranty:
If during the Warranty Period you submit a valid claim to Apple or an AASP, Apple will, at its option, ℹ repair the Apple Product using new or previously used parts that are equivalent to new in performance and reliability, (ii) replace the Apple Product with a device that is at least functionally equivalent to the Apple Product and is formed from new and/or previously used parts that are equivalent to new in performance and reliability, or (iii) exchange the Apple Product for a refund of your purchase price.
From this page (where you can choose your country):
http://www.apple.com/legal/warranty/
Realistically, they may replace the product after three attempts to repair the problem. In my case, it took 4 attempts over a period of 4 months during which time the MBP spent most of the time traveling or at the repair facility until they finally agreed to replace it when I asked. Unless there are many problems, they will replace the dead hard drive.