Is formaldehyde a carbohydrate?
According to IUPAC definition:


  ‘carbohydrate’ includes monosaccharides, oligosaccharides and polysaccharides as well as substances derived from monosaccharides by reduction of the carbonyl group (alditols), by oxidation of one or more terminal groups to carboxylic acids, or by replacement of one or more hydroxy group(s) by a hydrogen atom, an amino group, a thiol group or similar heteroatomic groups. It also includes derivatives of these compounds [...]




But according to Wikibooks  


  the term is generally understood in the biochemistry sense, which excludes compounds with only one or two carbons. Natural saccharides are generally built of simple carbohydrates called monosaccharides with general formula $\ce{(CH2O)_n}$ where $n$ is three or more [...]


Because formaldehyde and glycolaldehyde (not a true sugar) has one and two carbon respectively in its structures we can exclude both as a carbohydrate.