I am running a Ubuntu of version 12.04. Can I use a kernel of version of version 2.4 on it?
There might be a lot of things broken if you would use a kernel 2.4 on it.
First, such an old kernel might not (honestly it will not) recognize some or all your hardware because it did not exist at that time. Depending on the not recognized hardware you might or might not be able to start your machine.
Then, all the user space applications that directly communicate with the kernel might (or will) not work. Because the kernel architecture and feature changed that much that they are no longer compatible with it. Thus again you probably won't be able to boot.
So I would advise not to do it on a used system. If you really want to try it, create a VM, install Ubuntu in it, compile your kernel (if that works still!) and reboot the VM using this kernel. I doubt it will work, but who knows :-)