Well, this is certainly an area where a lot of styles can differ and judges can disagree. Personally, I find both of your examples to be a bit over-the-top and wouldn't enjoy them if I were judging (and if they played out as I picture them in my mind). I'll explain:
1) For your attorney example: by responding as you did, making a lot of noise and putting a snide emphasis on doctor, it sounds like you were being rude to the witness when the witness didn't do anything to prompt that. You're also displaying that rudeness, and a lot of frustration, in front of the judge, which lets the judge know that the other team had really gotten to you.
Really, if you take a step back, the other attorney was being rude first. It's easy to slip and say the wrong noun or title. If you had said "Mr." more than once, it might have been appropriate for the other attorney to stand up and, in an "I'm sorry I interrupted tone," remind you that the witness's title was "Dr." It sounds like that's not what happened. Rather, he/she seized on the first opportunity to spring up and demand, loudly, the respect that the doctor was due. In my opinion, the best approach there is to appear above the fray. Just say something like, "I'm sorry, Dr.," and then re-ask the question with the same force you'd been using. Then, instead of both of you looking petty, only the other team's attorney appears petty. That has to elevate your standing in the eyes of the judge.
2) For your witness example: I don't like this type of behavior, but how appropriate it is depends a lot on the type of witness. If this were an expert, I would have no patience for it. The real issue here, in my mind, has to do with the witness's ability to play a believable character. In real life, if you see a witness behave like this, it casts serious doubts on their credibility. A police officer who acts like a brat to a defense attorney probably isn't worth being believed, and an expert who behaves in a catty manner loses his/her professional credibility. It's revealing of bias, which colors everything else that person says.
Now in mock trial, of course, everyone knows that the witness is also a competitor. So this behavior doesn't have quite the same affect as in real life, but it does have the effect of breaking the fourth wall. If the witness is a charismatic person, all of a sudden you have a huge reminder that this person is a competitor engaged in a game of one-upsmanship. The better approach, in my opinion, is to behave like a more believable witness and wait for key strategic points to disagree or slip in testimony beneficial to your side.
Bottom line, though, I think there is room for being sassy / sarcastic once the other side proves they deserve it. Start off treating the witness with respect, and questioning him/her like you would any other; if the witness says something stupid or unbelievable, or if the witness won't answer a question, then some attitude becomes appropriate.
I think sarcasm is almost never wise in trial, especially as an attorney crossing a witness. When you're crossing a witness, your goal is very simple and very modest: to get out the facts that help your side and/or illustrate the weaknesses in the other side's position. The last thing you ever want to do is see your cross degenerate into some kind of argument or pissing match with the witness, which won't accomplish anything other than to make you look like a jerk (because judges will almost always favor the witness, who is the one being subjected to hostile questioning) and steer the emphasis away from whatever points you're trying to make.
Mock Trial with J. Reinhold! Mock Trial! Mock Trial with J. Reinhold!
The comedic value must substantially outweigh the bitter value, or you shouldn't say it.
Crosser: You're being paid for your time in court today, aren't you?
Witness: Yes, I am.
Crosser: In fact, the defense is paying you quite well, aren't they?
Witness: They are. I reckon I'm making almost as much as you, councillor.
Check "yes" if you're not a felon.
I think the worse the witness's attitude is, the more sass you can use. It depends a lot on who you're crossing, and how the character's played by the person. You can get away with more crossing a Lexington or a Frost than you can with crossing a Davis.
I think sarcasm is probably a dangerous gambit, but it can be appropriate under sufficiently aggravating circumstances.
Coach, Sun Devil Mock Trial
Back in the lab, with a pen and a pad....
What you did with the doctor sounds like an absolutely horrible idea.
I'd give you a 2.