Does Time Machine backup iCloud Drive files that are not stored locally? Does time machine make a backup of files which are stored in iCloud, but not stored on your local hard disk (i.e. files which have been removed from your local hard disk when the 'optimise mac storage' feature is enabled)?
No, these files are not backed up by Time Machine.

iCloud has its own deleted file recovery, available from iCloud.com Settings → Restore Files, but this isn't a substitute for backups since modified files are not stored, only those deleted completely.