As a child it was not that unusual – especially if going visiting people – to be told to “mind your 'p's and 'q's.”. The phrase simply meant to be on your best behaviour – to act politely and not mess around in any way.
There is a variety of suggestions as to the origins of the phrase all of them amusing but none of them conclusive. The first is that ‘p’s and ‘q’s was simply a shortened form of ‘pleases and thankyous’.
The second was that it arose as an admonition to innkeepers. They would chalk up whether their customers owed them for a pint or a quart. It would therefore be reasonable to ask them to be well-behaved and mind they didn’t mark up ‘q’s instead of ‘p’s.
A third suggestion is that it arose from the days when Frenchmen had to be advised how exactly to bow and not mix up their pieds (feet) and queues (wig-tails). This sounds like a typical anti-French remark from the days of the early nineteenth century.
But that latter idea is rather scuppered by the fact that the first use of the expression is claimed to be 1602 but it is not clear if the phrase/usage there is the same. In a Thomas Dekker play of that year the following appears:-
Afinius: ...here's your cloak; I think it rains too.
Horace: Hide my shoulders in't.
Afinius: 'Troth, so thou'dst need; for now thou art in thy Pee and Kue: thou hast such a villanous broad back...
'Pee and Kue' in that context seems to be referring to a form of clothing, but that is somewhat ambiguous. Dekker later used the term in West-ward Hoe, a joint work with John Webster, 1607:
“At her p. and q. neither Marchantes Daughter, Aldermans Wife, young countrey Gentlewoman, nor Courtiers Mistris, can match her.”