True or False: Let $G, H$ be finite groups. Then any subgroup of $G × H$ is equal to $A × B$ for some subgroups $A<G$ and $B<H$.(TIFR GS2018)
For a more general result:
Lemma. Let $G,H$ be finite groups. Then $\gcd(|G|, |H|)=1$ if and only if any subgroup of $G\times H$ is of the form $G'\times H'$ for some subgroups $G'\subseteq G$ and $H'\subseteq H$.
Proof. "$\Rightarrow$" Let $K$ be a subgroup of $G\times H$. Let $e_G, e_H$ be neutral elements of $G, H$ respectively. Now let $(x,y)\in K$. Since $\gcd(|G|, |H|)=1$ then it follows that the order of $y$ and $y^{|G|}$ are the same. Thus $y^{|G|}$ generates $\langle y\rangle$. In particular we have
$$(x,y)\in K\ \Rightarrow$$ $$(x^{|G|}, y^{|G|})=(e_G, y^{|G|})\in K\ \Rightarrow$$ $$(e_G, y)\in K$$
The last implication because $y$ can be generated from $y^{|G|}$. Analogously if $(x,y)\in K$ then $(x, e_Y)\in K$.
Now if you consider projections
$$\pi_G:G\times H\to G$$ $$\pi_H:G\times H\to H$$
then you (obviously) always have
$$K\subseteq \pi_G(K)\times\pi_H(K)$$ What we've shown is the oppositie inclusion which completes the proof.
"$\Leftarrow$". Assume that $d=\gcd(|G|, |H|)\neq 1$. Let $p|d$ be a prime divisor and pick elements $x\in G, y\in H$ such that $|x|=|y|=p$ (they exist by the Cauchy's theorem). Now consider a subgroup $K$ of $G\times H$ generated by $(x, y)$. This subgroup is of prime order $p$. In particular if $K=G'\times H'$ then either $G'$ or $H'$ has to be trivial (because the order of product is equal to product of orders and $p$ is prime). But that is impossible since $(x,y)\in K$ and none of $x,y$ is trivial. Contradiction. $\Box$
So what it means is that if the orders of $G$ and $H$ are not relatively prime then there is a subgroup of $G\times H$ that is not a product of subgroups of $G$ and $H$. This should give you plenty of examples, e.g.
$$G=H=\mathbb{Z}_{n}$$ $$K=\langle(1,1)\rangle$$
This is false: take for example $G=H$ and let $D=\{(g,g):g \in G \}$. Then $D$ is a subgroup of $G \times G$ and not a direct product of subgroups $A$ and $B$ of $G$. Why not? Since in $A \times B$ you will find elements of the form $(a,1_B)$ with $a \in A -\{1_A\}$. These do not exist in $D$.