Is the past tense correct in "Did you know Fred was a doctor?" [duplicate]
Tense use isn't dependent solely on current "real world" time: among other things, it also reflects some other time 'reference point' of events, which can arbitrarily be in the past or future relative to the time of speaking.
And so, the sentence "Did you know Fred was a doctor?" does not necessarily make any reference to whether Fred is currently a doctor in terms of "real world" time, but rather whether they were at the time reference point of the "knowing". Whether or not they currently are a doctor at the time of speaking is irrelevant: that isn't the point of time being referred to.