This is not genetic but not "necessarily hereditary", this is hereditary, but requiring a combination of inherited "things" to manifest. (The typical simple case of "Mendelian trait diseases" to which this applies are recessive traits, which require inheriting a copy of the gene from each parent to manifest.)
IQ, not being a binary trait, doesn't work the same way, and probably (even to the extent it is genetic) the product of isn't a single, simple genetic trait of any kind, but influenced by a number of different genes. And, also, influenced by lots of environmental factors (and it may turn out that the way in which some of those environmental factors contribute depends on which combination of genetic factors are present.)