To be honest it's extremely rare you need to use Sir/Ma'am. At school we used to use Sir/Miss but I think a teacher would tell a pupil the best way to address them. If you want to get someone's attention but think it's important to appear formal then 'excuse me' will be fine. You're unlikely to meet royalty to be honest and I still think 'Your highness/majesty' is expected (we were told to use these terms when Princess Anne visited our work place, luckily I didn't get a chance to use it!), though if you want to call 'The King' Mx or something similar you are welcome to try it, though some might be offended!