Macs normally have one of three different physical keyboard types, which Apple calls JIS (for Japan), ISO (used in Europe, for example) and ANSI (used in the US). ISO has one key more than ANSI -- it is located between z and shift -- and JIS has quite a few differences.
Sometimes a machine will forget which type keyboard is attached, with the result that certain keys get transposed from what the user expects. The fix for this is run the Keyboard Setup Assistant again. Sometimes there is a button for "Change Keyboard Type" visible in System Preferences/Keyboard. If not, you can try trashing the file
Another possibility may be to open Terminal and type:
sudo open /System/Library/CoreServices/KeyboardSetupAssistant.app/Contents/MacOS/KeyboardSetupAssistant
Sometimes, when JIS is involved on a laptop, one may have to follow the procedures in the PMU Resetting instructions.
For reference, this doc shows the different keyboards supplied by Apple around the world.