Is it possible to install Ubuntu on a CD that will allow boot-up if it is in the CD drive, but otherwise will allow Windows to boot?
2 Answers
Not really. Ubuntu does not fit on a CD anymore; assuming we are not talking about a mini ISO install. You need at least a DVD but those too are read only mediums so do not work that well: it will put everything into RAM making it slow.
You should use a USB stick if possible: you can make that "persistent" and have more partitions on it so you can save files into the 2nd partition. See for instance How can I make a 19.04 persistent live USB from Windows? or the older How to make a live Ubuntu 18.04 USB with a persistent storage of more than 4GB and https://wiki.ubuntu.com/LiveUsbPendrivePersistent
You will need a 4Gb stick for Ubuntu 18.04 and newer. 2Gb is too small.

- 299,756
From a CD? Yes (Well, with a DVDR, if you want Ubuntu with a Desktop). A CDR does not have enough space for the complete Ubuntu, not even the smallest complete flavour (Lubuntu 19.10), but all Ubuntus will fit on a DVDR.
The only Ubuntu images which will fit on a CDR are the Network Installers, which are only suitable to install Ubuntu over the Internet, not to run it, AKA Core images, such as Ubuntu Core (Legacy BIOS mode only, not UEFI-capable), Ubuntu MATE Core, Xubuntu Core, and Lubuntu Core.
You can modify your PC's BIOS/firmware settings to boot from the optical drive if the optical disc is loaded, and if not, to boot from the hard drive.
The same holds true for a USB drive (which will boot much faster, and give you the option of storing files on it) which has been configured as a Ubuntu LiveUSB with Persistence, and you can do that now with Ubuntu 19.10 and the Rufus windows app to create the LiveUSB.
USB Flash Drives have gotten very small, less than half an inch for the part which sticks out of the socket, so it's very convenient to put one of those in a USB socket and carry your laptop around with it loaded.

- 17,202