Is it necessary to have a /home and /swap partitions in 20.04
Solution 1:
/home partition: A separate /home partition has never been necessary. It has always been optional.
The Ubuntu installer has well-considered and quite sane defaults to create a working system for new and/or unskilled users. That default does not create a separate /home partition.
Some folks prefer a separate /home partition, others don't.
/swap partition: Since 18.04, a separate swap partition in most Desktops has been superseded by a swap file within the root partition. A separate swap partition is no longer recommended for most new Desktop users. Swap in a server is a little more complex; swap is recommended for some advanced uses (like non-ext filesystems).
Advice for new users: For your first install, stick to the installer defaults as much as possible. Focus on making your first install successful rather than perfect. You can always repartition/reinstall a more complex system later -- Ubuntu makes it easy.
Solution 2:
Is it necessary to have a
/home
and swap partitions in 20.04
Certainly not. You may stick to the defaults, that is a single partition holding your files, and perhaps another partition for swapping. On some recent Linux distributions, swapping happen into a swap file (this is slightly less efficient but can be much more convenient, because you won't use a separate disk partition for swap). See swapon(8) and mkswap(8) and the underlying swapon(2) system call. If you are curious, read about virtual memory, file systems, the page cache, and some textbook on operating systems.
An astute reader might want to have a different /home/
partition to be able to later and easily change his/her Linux distribution (e.g. to Debian or Fedora) without losing their data. This is not necessary, but might be useful.
In all cases, don't forget to backup your important data (preferably on a different medium or on some remote server). Hardware disks do fail, and you will make mistakes. You might even automatize your backups (e.g. with crontab and rsync).