I am exiting Japan soon and want to show one passport to leave and another to the airline. Does the official who stamps the exit stamp ask to see boarding pass? Do boarding passes show passport numbers/nationality, or only name?
No. The boarding pass has your identity, details of your flight, seat, class and sometimes pricing info. I have never seen one with a passport number or nationality.
EDIT: According to the comments though, it does happen in a few cases, so it's not an absolute No, although I can say that among a sample of a few hundreds of flights which I have taken, I have never seen it. Note that some domestic flights do not even require a passport.
It is common to show two passports to different officers when you have dual nationality. For example, you usually show the passport of the nation you are going to the gate agent, otherwise they will ask to see a visa. You may show a different passport to an immigration offers when there is one to check departures. This is not always the case as some countries do not have departure immigration control.
While you almost always have to show your boarding pass to many officers, including possibly the check-in counter, gate-agent, security agents, people sorting and directing you, plus to the baggage check agent, it is rare that you need to show your boarding pass to immigration. The most common case though is for transiting via a third country, in which case the boarding pass is an easy proof of intention of transit.
EDIT 2: About showing the boarding pass, I said rare but not never. I have only been asked once, again among hundreds of flights going through over 50 countries, but have done it several times voluntarily to explain transit. As in:
- Officer: "How long are you staying in China?"
- Me: "3 Hours, here's my onward pass to Malaysia."
Most times immigration offers just want to know what you are allowed in or out, depending if its is an Exit or Entrance. Passports, visas, letters or invitation are usually the supporting documents for that.
To answer the second part of your question, boarding passes sometimes do show passport numbers.
Examining my collection of old boarding passes, a self-printed easyjet boarding pass, as well as boarding passes from Air New Zealand and KLM, all show my passport number.
Also, I have a Lufthansa boarding pass that while not showing a passport number, does indicate the nationality of my passport.
As to the first part of your question, I am not sure about the specifics for Japan, but countries vary as to whether the boarding pass is requested by the immigration authorities or not. As mentioned in the comments to your question, see I have two passports/nationalities. How do I use them when I travel? for how to use the two passports while travelling.