Does Ubuntu have antivirus pre-installed?
No, and there are very few antivirus tools available for Linux distros most of which only scan for Windows viruses. The only security tool I'm aware of that supports scanning for Linux viruses is Eset Node32 Antivirus For Linux. That all said there are very few known viruses for Linux.
Notes:
OSX didn't used to get viruses either.
Just because viral code (eg a Windows virus) can't infect your system doesn't mean you want it stored on your hard drive, especially if you share files with friends/family, or dual boot with Windows.
How does Ubuntu defend itself From Viruses And Hackers?
Ubuntu relies on security updates, and permissions to protect itself. For example the important system files are owned by root to prevent anyone from changing them which is why you have to use sudo so often.
Notes:
- Windows uses the same approach of permissions, but it often fails because people use Administrative accounts rather than user accounts. My point being that permissions on any operating system only work if the user demonstrates good practice. This means not giving root priviledges without thinking first, and never installing programs from sources you don't trust. The system isn't exposed unless a user exposes it.
Does Ubuntu have a firewall pre-installed?
Yes, IPTABLES partnered with UFW, but it doesn't come with any pre-setup rules so you're not protected.
Notes:
- It's a good idea to disconnect from the network you get your internet from when you're not using it.
In summary an Ubuntu installation is as protected as a Windows installation, and the first thing you'd do on Windows is install a better firewall and antivirus, but on Ubuntu there aren't any comparable tools so you're hooped. Luckily Ubuntu is less targeted.