I taught middle school for 11 years and high school for 5, and yes, the only way a girl can be smart without fallout is if she is quietly smart, never tries to be funny, and is willing to be the silent, admiring audience to all the loutish boys demanding attention every day. She can write well and test well, but she'd best keep her elbows in and stay quiet. And smile when the boys want smiling.
And too many men continue to feel that way about women: it's okay to be smart, as long as we remember that we are just women, and men's need for attention and reassurance must always come first.