In the programme, which aired late on Wednesday in the US, Mr Cameron was quizzed on his knowledge of British history and culture.
He has been in New York for two days at the United Nations General Assembly.
The show’s host, David Letterman, has been a prominent fixture on late night US television for 30 years.
There were no questions about Andrew Mitchell, or Boris Johnson or the state of the coalition.
Instead, when David Cameron appeared on the Late Show with David Letterman, he found himself being closely interrogated about British history and culture – and he revealed one or two gaps in his general knowledge.
He was able to explain the differences between the nations of the UK, the size of the population and the extent of the British Empire.
But much to his embarrassment, Mr Cameron was unable to say what Magna Carta meant in English or who wrote the words and music of Rule Britannia.
And if that wasn’t enough, Mr Cameron then had explain why Britain wasn’t in the euro, why British gun control laws were tougher than Americas and why Larry the Downing Street cat is such a poor mouser.
What the three million Americans watching made of it is not known. But when David Cameron returns home later this week, he will probably be hoping the border staff don’t ask him to complete a citizenship test. His chat show – one of the most watched in the US with some three million daily viewers – is well known for its hard-hitting political interviews, with past guests including Barack Obama, Tony Blair and London Mayor Boris Johnson.
‘A falling out’But in Wednesday’s show, Mr Cameron was welcomed by a band playing Rule Britannia, and dry ice being pumped into the studio to represent a London fog.
Asked briefly about the Arab Spring and his UN trip, the prime minister then faced questions about the composer of Rule Britannia, guessing incorrectly at Edward Elgar.
The right answer, he was informed by Mr Letterman, is Thomas Arne – setting words by James Thomson to music.
Mr Cameron was also unable to provide an English translation of Magna Carta, which means great charter.
Hesitating before naming Runnymede as the place it was signed, he correctly answered 1215 as the date the Magna Carta was drawn up and told Mr Letterman about its significance in the origins of democracy.
The show’s host later questioned Mr Cameron about Britain’s four nations.
Mr Letterman said: “What is the deal on Wales? Did they vote for you, the people of Wales?
“Some of them did,” Mr Cameron replied.
The prime minister raised a laugh in the studio when he joked about the UK’s relations with the US.
“There were some good bits and some less than good bits, and obviously we had a bit of a falling out.
“I like to think we’ve got over that now.”
‘Not very popular’
But he avoided commenting on US Republican presidential candidate Mitt Romney, who had questioned London’s preparations for the Games.
“The idea that two major world class athletics events took place in London… who would have bet against that going off flawlessly, as it seems to have done?” Mr Letterman asked.
Mr Cameron prompted the loudest applause of the evening when he explained that Britain does not allow political advertising, a big issue in the US where multi-billion dollar attack ads are being used in the presidential campaign.
However, he added that he was first recognised in the US because of television, when a passer-by spotted him on a New York street and shouted: “Hey, Prime Minister’s Questions – we love your show.”
Mr Cameron later said he wanted his appearance on the Late Show with David Letterman to help “bang the drum” for British business in the US.
He spoke about the creation of one million private sector jobs by his government over the past two years.
But he also admitted he is “not very popular at the moment”, pointing to austerity measures and cuts as a possible explanation for his low ratings.
Mr Cameron is the first sitting British prime minister to appear on the show, although Tony Blair has appeared on it twice since leaving office.