Parents can be a huge influence on how confident you are.
Lord Mountbatten’s mother told him he would rule the world or something similar, so he behaved accordingly. I wish I had had that, I was shy for a long time. I think it’s better that way though in the long run, as spoilt, confident children often turn into nasty adults.
As others have said, most people are a mix and different situations bring out different reactions.
I have an assumed confidence and a real confidence as I love talking to people and being in good company. The assumed confidence is through stage work, a case of “Fake it till you make it”
Shakespeare said we are all players in our life, acting out various roles.