It is thought the messages might have been posted on Twitter by someone who thought the BBC’s rehearsal was a real event.

After speculation began to mount about the Queen, a Buckingham Palace spokesman said: “I can confirm that the Queen this morning attended her annual medical check-up at the King Edward VII’s Hospital in London.

“This was a routine, pre-scheduled appointment. The Queen has now left hospital.”

The BBC apologised for the tweet, which it said had been posted in error.

It said in a statement: “During a technical rehearsal for an obituary, tweets were mistakenly sent from the account of a BBC journalist saying that a member of the Royal Family had been taken ill. The tweets were swiftly deleted and we apologise for any offence.”