Got the solution to my problem for all those who are facing the same problem here are the steps I followed:
You need to connect ethernet interface of the system to the internet to install the necessary packages. I believe you have a working internet connection then follow these steps:
Install additional driver's in Ubuntu.
While installing Ubuntu 12.04 I had to check the mark which shows to install additional third party softwares and drivers during installation:
Check the box which says Install third party softwares.

2.After installation has finished you will be presented with default kernel of Ubuntu 12.04.
In my case it was 3.5
So, now install the kernel version 3.6.11
get its packages from the link below:
Kernel PPA
Download the kernel files from above link then install the files using the command:
dpkg -i file-name
then
update-grub
and
reboot
Your system will reboot now if everything done right you will no be running kernel version 3.6.11
you can check it by the command uname -a
3.After successfull installation of linux kernel 3.6.11
when you will check in the networks it will show an error stating Firmware missing
so now we will copy the firmware of ralink rt3290 to the directory /lib/firmware
Get the ralink rt3290 firmware using the command:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
then copy the firmware
cp linux-firmware/rt3290.bin /lib/firmware
then
reboot
After the reboot has finished your wifi should be working now and without any kernel panic errors. This solution worked for me in Ubuntu 12.04
hope it helps others as well.