Probability problem clarification request

My dad heard this story on the radio. At Duke University, two students had received A’s in chemistry all semester. But on the night before the final exam, they were partying in another state and didn’t get back to Duke until it was over. Their excuse to the professor was that they had a flat tire, and they asked if they could take a make-up test. The professor agreed, wrote out a test and sent the two to separate rooms to take it. The first question (on one side of the paper) was worth 5 points, and they answered it easily. Then they flipped the paper over and found the second question, worth 95 points: ‘Which tire was it?’ What was the probability that both students would say the same thing? My dad and I think it’s 1 in 16. Is that right?

(a) Assuming that the students did not actually have a flat tire and that each student gives any given tire as an answer with probability 1/4, then probability that they both give the same answer is 1/4. If the students actually had a flat tire, then the probability is 1 that they both give the same answer. So, if the probability that they actually had a flat tire is p, then the probability that they both give the same answer is $$\frac{1}{4}(1-p)+p=\frac{1}{4}+\frac{3}{4}p$$

Could someone expound on how the formula was derived? (primary question)

Also I guess the easier way to see that 1\4 is the correct answer would be writing out all possible outcomes as ordered pairs, of which there will be 4 outcomes where the first term = the second term out of 16 total outcomes?

They have a probability $p$ of having a flat tire, so they have a probability of $1-p$ of not having a flat tire.
If they have a flat tire, we assume the students know which tire it was, so the probability that they say the same tire is $1$.
If they do not have a flat tire, we assume that the students will choose a tire at random, in which case there is a $1/4$ probability that they will say the same tire (a way to see this is that the first student picks a tire, and then there is a 1/4 chance the other student picks the same one).
To get the same answer, one of two things has to happen: (1) they didn't have a flat, but said the same tire, or (2) they did have a flat and said the same tire. Since these are mutually exclusive, we find the separate probabilities of their occurrence and sum to get the probability $$\frac{1}{4}(1-p)+p = \frac{1}{4}+\frac{3}{4}p.$$