Some good news at last! After the failed factory reset, I checked the hardware with 'bubble' and 'phone tester' apps. Both failed to work. So I finally gave up, thinking that it is a hardware issue. I had decided to visit a Samsung service centre the next morning.
In the morning, I switched off the mobile and removed my SIM before taking it to the service centre. All of a sudden, autorotate started working again!
Although it is not working in the pull-down screen and list view of apps, it is working in all the other areas like contacts, gallery and book readers.
I am not sure what caused the problem. I hope it does not recur again!
I hope others with similar problem find this thread useful!