Re: Gender question - Except for certain government jobs and the rare job where being of a particular sex is actually a requirement, the only place you should see the question is on a voluntary EEOC survey. If you don't want to draw attention just opt out of the entire survey.
Re: Past names question - The only reason an employer needs to know them (once again certain government jobs excepted) is to properly check your records. If ALL of your past employers and schools (that the application asks for) have been notified of your name change and it's recorded on your record, and you have NO unsealed adult criminal history whatsoever (not even minor infractions) simply put down "none that relevant records would be under" or something similar (beyond the trans* community I suggest this to those who had a name change due to adoption or other reasons as a child - although you typically don't even need to bring it up if you're worried you can use an "alternative" response like the one given). Unfortunately, if they need to know the former name to properly verify past employment or education you'd have to bring it up unless you want a false negative - and if they do a criminal records check and they don't see your full criminal history because you didn't list the name it was under you can get in trouble (another alternate idea here is to say you'll give the sensitive information straight to the agency doing the check).
(All this assumes a job in the U.S.)