This is exactly right - to both parts of your question. So, let's explore what MHCI (and a bit of MHCII) are supposed to do so you can see how these molecules work and their role in infection and cancer.
MHCI is found on all nucleated cells of your body (not red blood cells, but everything else). MHCI is responsible for presenting antigens to the immune system, in particular CD8 Tcells (cytotoxic T cells). If the antigen presented is a normal or self antigen, nothing happens. The peptides are from the normal breakdown of proteins. Proteins that are "worn out" or no longer needed are digested into smaller peptide fragments in an organelle called the proteasome, in the same way stomach acid breaks down food. If the antigen is a foreign one, then the Tc cell will kill the presenting cell.
So, how do you get foreign antigens. MHCI presents every peptide that is happening inside a cell (endogenous or internal to the cell). That is a key point. This is a way for the immune system to be doing surveillance all the time...asking "Are the cells normal?" Thus, you can think of MCHI as a sampling system.
1. Virus infected cell--with either foreign DNA or RNA from the virus--yes, these viral peptides get made and presented via MCHI exactly through the same mechanism as the normal or self peptides do. But now, the Tc cells see that this is not a normal or self peptide and kill the presenting cell.
2. Cancer...not all cancers are caused by viruses -- but all rely upon mutations of the normal DNA which then also leads to changes in the proteins /peptides of a cell. Even these small changes, sometimes a single amino acid change, can be seen as foreign and a Tc cell will kill a cancer cell. This is another function of immune surveillance. Unfortunately, cancer changes can be very small indeed, or perhaps only change the amount of a normal protein, thus many cancers escape immune surveillance.
3. Even in really well matched organ transplant cases, you can get minor rejection. Organ transplant relies upon matching the MCHI of the donor to the recipient or the Tc cells will see the foreign MCHI and kill the organ outright. But, other proteins begin presented in the normal way may have some slight differences or polymorphisms, even in perfectly matched MCHI types, that lead to slow rejection (rejection due to minor antigens) or decreased function of the organ.
Some viruses and some cancers have developed the ability to decrease the amount of MHCI on cells, thus preventing the immune system from seeing the foreign antigens because they are just not expressed. HIV can do this; so do many other viruses. We do have a back-up system that kills cells that are missing their MHCI. They are called NK cells or natural killers. For transplantation, this minor rejection mechanism is what the drugs are meant to prevent.
MHCII is different because:
1. The antigen peptides come from things a phagocytic cell has eaten (exogenous/outside to the cell).
2. MHCII is only on immune cells, so the cells that go around gobbling up bacteria and other junk are able to digest these and then present the foreign peptides via MCHII.
3. MCHII/antigen is presented to T helpers CD4 cells which then support Tc and B cells that make antibodies.
There is some cross talk between these two systems...nothing is ever all or none with our immune system. There are backups and backups and crosstalk in order to give us the greatest ability to survive infection.