I have a non EU passport, but I have a Multiple entry Schengen Visa. I plan to travel from Serbia to Romania to Hungary by train. My situation is absolutely legal but i am worried the time it takes to do the border checks... I will be traveling by train. I read on this page that border checks are done by police who board the train. Is this correct? That means that I will not have to make any queues to get my passport stamped, right? All I have to do is relax and wait for the police to come to me and check my papers... Please confirm if this is right.
I'm Serbian and have crossed the Romanian border several times to go to the Timișoara airport which is conveniently close to my home town. I've never had problems myself, but I have the need to point out this particular border is infamous in my home area as being quite unpredictable. What follows is based on stories I've heard, so take it with a grain of salt, but it's still good to keep in mind.
It's not uncommon to be asked to show either a bank statement or present cash as proof you can support yourself. While this is true for many other countries, Romanian customs officers are known to be very strict about it.
Smuggling used to be (and arguably still is) very common on the Serbian-Romanian border and the customs officers are well aware of it on both sides. Asking to search the car or open suitcases is common and happened to me twice when I was crossing the border, which can be a delay for your travel.
I was also told the customs officers will sometimes claim you are violating a rule e.g. you are carrying too much tobacco according to some "new rules" that you never heard about only to request a bribe. If this happens, assuming you don't agree with going ahead with the bribe you may, again, be delayed.
These apply much less, as you may guess, when it comes to travel by train. The customs officers will usually enter the train, check your passport and stamp it if needed and carry on. They may ask you questions about your stay in Romania, so just be honest and point out that you are only in transit and will be going to Hungary afterwards (it's a good idea to have some proof of this, such as train tickets or hotel bookings).
In general, yes, that is right, but I have never traveled to the countries you mentioned, except for a train trip from Budapest to Vienna in 1988, which worked as you described. (I entered Hungary from Austria by car.)
More recently, but before Slovenia joined the Schengen area, I traveled by train between Slovenia and, variously, Italy and Austria. There, it also worked as you describe.
If there is an exception specific to your route, I would not know about it.