I am a international student, came to USA on F-1 visa from India and graduated last year. this year (2014) my company filed H1-B and got approval. Now I am on my H1-B from this October. When I file my taxes for 2014 which form do I have to use (1040 or 1040NR) ?
1040 or 1040NR depends on whether you are a resident alien or nonresident alien -- 1040/1040A/1040EZ for resident aliens, and 1040NR/1040NR-EZ for nonresident aliens.
Determining whether you are a resident is somewhat complex, and there is not enough information in your question to determine it. Publication 519 is the guide for taxes for aliens. (It hasn't been updated for 2014 yet, so mentally shift all the years in the publication up by one year when you read it.)
Since you don't have a green card, whether you are a resident is determined by the Substantial Presence Test. The test says that if (the number of days you were in the U.S. in 2014) + 1/3 of (the number of days you were in the U.S. in 2013) + 1/6 of (the number of days you were in the U.S. in 2012) >= 183 days (half a year), then you are a resident alien for 2014.
However, there are exceptions to the test. Days that you are an "exempt individual" are not counted toward the Substantial Presence Test. And "exempt individuals" include international students, trainees, teachers, etc.
However, there are exceptions to the exceptions. Students are not "exempt individuals" for a year if they have been exempt individuals for any part of 5 previous calendar years. (Different exceptions apply for teachers and trainees.) So whether you are an "exempt individual" for one year inductively depends on whether you have been an "exempt individual" in previous years.
Long story short, if before you came to the U.S. as an F-1 student, you haven't been in the U.S. on F-1 or J-1 status, then you will be a nonresident alien for the first 5 calendar years (calendar year = year with a number, not 365 days) that you've been on F-1. We will assume this is the case below.
So if you started your F-1 in 2009 (any time during that year) or before, then you would have already been an exempt individual for 5 calendar years (e.g. if you came in 2009, then 2009, 2010, 2011, 2012, 2013 are your 5 years), so you would not be an exempt individual for any part of 2014. Since you were present in the U.S. for most of 2014, you meet the Substantial Presence Test for 2014, and you are a resident alien for all of 2014.
If, on the other hand, you started your F-1 in 2010 (any time during that year) or after, then you would still be an exempt individual for the part of 2014 that you were on F-1 status (i.e. prior to October 2014. OPT is F-1.). Days in 2014 in H1b status (3 months) are not enough for you to satisfy the Substantial Presence Test for 2014, so you would be a nonresident alien for all of 2014.
If you fall into the latter case (nonresident alien), there are some alternative choices you have. If you were in the U.S. for most of those last 3 months, then you are eligible to choose to use the "First-Year Choice". I will not go into the steps to use this choice, but the result is that it makes you dual-status for 2014 -- nonresident until October, and resident since October. If you are single, then making this choice pretty much gives you no benefit. However, if you are married, then making this choice allows you to subsequently make another choice to become a resident for all of 2014. Being resident gives you some benefits, like being able to file as Married Filing Jointly (nonresidents can only file separately), being able to use the Standard Deduction, being able to use many other deductions and credits, etc. Though, depending on what country you're from, it may affect your treaty benefits, so check that before you consider it.
Since you were a nonresident alien student on F-1 visa then you will be considered engaged in a trade or business in the USA. You must file Form 1040NR. Here is the detailed instruction by IRS - http://www.irs.gov/Individuals/International-Taxpayers/Taxation-of-Nonresident-Aliens