I am living in UK and I want to visit Romania for few days for conference purpose. As I know, if I hold a Schengen visa, I can stay in Romania up to 5 days without applying for another visa. However, I am wondering, will a Schengen state (for example, Hungary) grant a visa which will cover my period in Romania as well? If I book a ticket UK-Romania-Hungary-UK, will the visa cover my whole journey because Romania is not a Schengen member?
(You have not stated what nationality you are, but I'm presuming that you are from a country that would normally require a visa to visit Romania)
Romania does have an exception from obtaining a Transit (type B) visa in specific circumstances, which is what you are referring to. In order to obtain this exception you must be transiting through Romania (ie, arriving from and departing to a different location), and you must hold a valid Schengen Visa, or a visa from Iceland or Norway.
Whilst you seemingly meet these provisions, your issue is that this gives you the equivalent of a Romanian "Transit visa", however you have stated that you are visiting Romania in order to attend a conference which is almost certainly not allowed under a Transit visa.
Whilst it may be possible to enter the country without being detected by claiming you are simply "in transit", if it is discovered that you are actually in country in order to attend a conference you can expect to experience problems when entering or leaving the country as you will technically be in the country illegally.
I would strongly suggest that you obtain a valid Romanian "short-stay visa for business purposes (marked C/A)" which is the correct type of visa for attending a conference.
Romania is not (yet) part of the Schengen area. Nevertheless, having a Schengen visa eases the entry to Romania.
As of the 1st of February 2014, if you stay less than 90 days in Romania and if you have a valid Schengen visa, you don't need a Romanian short-term visa.
A valid visa means here that the visa has to be valid when entering Romania and it still has to be valid when you leave Romania. Thus, you cannot enter Romania on the last day of your Schengen visa and then stay 90 days in Romania.
Source: Romanian Ministry of Foreign Affairs
I am assuming you don't hold a passport from an EU member. You wouldn't need a visa if it were like that.
It is true: with a Schengen visa you can stay in Romania for up to five days. See http://www.mae.ro/en/node/2040
That being said, if Hungary gives you a Schengen visa, you can do your trip as planned.