  Let $\mathcal G$ denote the space of finitely generated marked groups. We
give equivalent characterizations of closed subspaces $\mathcal S\subseteq
\mathcal G$ satisfying the following zero-one law: for any sentence $\sigma$ in
the infinitary logic $\mathcal L_{\omega_1, \omega}$, the set of all models of
$\sigma$ in $\mathcal S$ is either meager or comeager. In particular, we show
that the zero-one law holds for certain natural spaces associated to hyperbolic
groups and their generalizations. As an application, we obtain that generic
torsion-free lacunary hyperbolic groups are elementarily equivalent; the same
claim holds for lacunary hyperbolic groups without non-trivial finite normal
subgroups. Our paper has a substantial expository component. We give
streamlined proofs of some known results and survey ideas from topology, logic,
and geometric group theory relevant to our work. We also discuss some open
problems.
