An Exclusive

Problem 1

XOR

Problem 2

YES

Problem 3

You could use the same key repeatedly, XORing the message’s first 16 bits with the key, XORing the message’s next 16 bits with the key, and so forth.

Problem 4

Reusing the key potentially leaks information. If an adversary has access to the ciphertext and knows (or guesses) one of the letters or words in the plaintext (perhaps because it’s a common word like “a” or “the”), they could figure out what value was XORed to those letters or words in the plaintext that yielded that ciphertext. They could then repeatedly apply that value to other letters or words in the ciphertext to recover (more of) the plaintext.

Problem 5

It swaps the values at a and b, in which case a better name than f would be swap!

Problem 6

If the two drives that failed both originally contained files, you would lose all of your files. If one of the two drives that failed originally contained files and the other contained the XOR of that drive and your other drive (that didn’t fail), you would lose half of your files.

Problem 7

You need one additional drive on which you should store A ^ B ^ C, or, equivalently, (A ^ B) ^ C or A ^ (B ^ C), where A, B, and C are, in any order, your three drives.