Official information about the visa situation can be found on the Romanian Foreign ministry website. Romania is not part of the Schengen area yet so they can't issue Schengen visas and there will be a control and an entry or exit stamp at the border with Hungary (Romania is actually ready and willing but other EU countries vetoed the entry).
Because of this delay, Romania recently decided to unilaterally let Schengen visa holders enter the country under more generous conditions than before. Flying to Romania and visiting the country on the way to Hungary should therefore not be a problem at all. The issue is coming back to return the car and catch your flight back to Dubai. If you have a single entry visa, when you leave the Schengen area, that visa ceases to be valid because you exhausted all the entries. That's why the page I cited before states (I highlighted the most relevant bits):
According to Emergency Government Ordinance no. 109/2013, as of February 1st 2014, the bearers of uniform visas (with 2 or multiple entries), long-term visas, as well as residence permits issued by Schengen Member States shall no longer be required to hold a short-stay visa to enter the territory of Romania for a time period that may not exceed 90 days in any 180 day period.
In order for the bearers of the aforementioned documents to benefit from the facility of entering Romania without holding a Romanian visa, the number of entries as well as the right of stay established as per the Schengen visas, must not have been exhausted.
The problem is that the country issuing your Schengen visa might not see any need to issue a two-entry visa since you are in fact only planning to enter and leave the area once. The rest of the page is not very clear but if you do get a single entry visa it would seem more prudent to apply for a Romanian visa as well. Obviously, all this assumes that you do need a visa in the first place, which depends on your citizenship but you probably knew that already.
Renting a car and crossing those borders is in principle not a problem but what you will need for that and the exact conditions will depend on the car rental company. If you need more information about that, you could perhaps ask another, more focused, question.