In polite circles it would be considered offensive, yes.

There are a couple of geographically related, non-offensive alternatives:

> What on earth ... ?

<!-- break -->

> What in heaven's name ... ?

Less offensive (but still not to be said in front of mum):

> What the heck ... ?