First of all, by the Chinese Remainder Theorem, it suffices to consider prime powers $q$. For composite $q$, the number of solutions will be the product of the solution numbers for the respective prime power parts of $q$.
So assume $q = p^m$, $p$ prime.
For elements $a\in\mathbb{Z}/q\mathbb{Z}$, we define the $p$-adic valuation $v_p(a)$ as the maximum exponent $e$ such that $p^e \mid a$. In the special case $a=0$, we set $v_p(a) = m$.
Now set $N = \min\{v_p(g_i) \mid i\in\{1,\ldots,r\}\}$.
For Question 1, the answer is $q^{r-1}\cdot p^N$.
This can be proven by induction over $m$, for example.
Apparently, Question 2 doesn't have a solution if $N \neq 0$.
For $N = 0$, the number of solutions is $q^{r-1}$.
(Let $i$ be a index with $v_p(g_i) = 0$. Then $g_i$ is a unit. Now for each choice of the $r-1$ entries $a_j$ with $j\neq i$, there is a unique $a_i$ s.t. $a^T g = 1$.)