Suppose I have 'example.com' and want it to be pointing to an IIS server, to reach my ASP app. Can I also have sub.example.com pointing to an Apache server (physically on a different computer, with different IP) to serve a web document? How can I do it? I want to do this with Azure and Digital Ocean.
Yes, you can do. You can run any child domain (sub-domain ) on a different server using different web server application (Apache,IIS etc). All you can do is create a sub-domain (A record) in your registrar provided control panel for your main domain and point to the IP where your sub-domain web-server is running.
Also make sure that your ServerAlias (in case of Apache server), as your subdomain fqdn name. It should be same for other web-servers configuration.