The part of speech of "Who" and What"?

Hi,

As far as I know “to be” doesn’t have an object, so my question is as follows: what part of speech are both “who” and “what” in the sentences below.

Who is the mayor of this town?
Somebody is the mayor of this town.
The mayor of this town is Somebody

What is your name?

Something is my name.
My name is Something.

Any comments would be greatly appreciated.