Outside of Chinese class, do people ask 你家有几口人？ Among one of the earliest questions people learn to answer when studying Chinese is

你家有几口人？
How many people are in your household?

However, despite living in China for years, I don't recall a Chinese person actually asking this question outside of Chinese class.  In fact, if we Google &quot;你家有几口人？&quot;, virtually all of the hits are lessons for non-native Chinese speakers (except for one Bilibili video).
Question: Outside of Chinese class, do people ask 你家有几口人？
For proof of concept, 你好吗？ is commonly taught in Chinese class, yet seldom used (see e.g. YouTube video), so these things exist.
Actually, very very seldom.  If (not when) people start asking me question like that, I would ask back: &quot;You FBI?&quot;
As a matter of fact, family information is usually voluntarily revealed, not asked, unless for certain reason, and even that, very specific, not generally.
If you want to get to know a person better, there is only one way:  lots of exchanging information thru chatting.  Family particulars, obviously, are included.  You accumulate this scattered information to form the big picture about the family.