If a currency is pegged to another currency which collapses, what happens? If a currency X is pegged to another currency Y which collapses, what happens to currency X?
You need to define "pegged" and "collapses"...
Setting a fixed exchange rate is by controlling the local currency's amount of money

If the economy of currency X's owner goes bankrupt (a "collapse"), why would the Y currency owner continue to keep the attachment...?
Usually "pegging" currencies together is to a strong currency, like the US dollar

If the onwer of Y currency will keep attaching Y to X, it will create a local hyper inflation, and hurt its own economy...