7. Given a sequence whose terms are 1 or 2, the first term is 1, and there are $2^{k-1}$ 2's between the $k$-th 1 and the $(k+1)$-th 1, i.e., $1,2,1,2,2,1,2,2,2,2,1,2,2,2,2,2,2,2,2,1, \cdots$, then the sum of the first 1998 terms of this sequence is $\qquad$ .
7. 3985 We consider the $k$-th 1 and the $2^{k-1}$ 2s that follow it as the $k$-th group, consisting of $2^{k-1}+1$ terms.

Let the 1998th term be in the $k$-th group, then $k$ is the smallest positive integer satisfying
$k+\left(1+2+2^{2}+\cdots+2^{k-1}\right)=2^{k}+k-1 \geqslant 1998$.
Since $2^{10}+10-1=1033<1998$ and $2^{11}+11-1=2048>1998$,

we have
$$
k=11.
$$

Thus, $S_{1998}=2 \times 1998-11=3985$.
Comment: This problem involves a grouped sequence. For a given sequence $a_{1}, a_{2}, \cdots, a_{n}$, when its terms are regrouped according to certain rules, the new sequence formed by these groups is called a grouped sequence. For this problem, first determine which group the 1998th term belongs to, and then calculate $S_{1998}$, which is not difficult. We can also further ask:
Does there exist a positive integer $n$ such that the sum of the first $n$ terms of the sequence $S_{n}=2001$? If it exists, find the value of $n$; if not, prove your conclusion.
If there exists $n \in \mathbf{N}^{+}$ such that $S_{n}=2001$.
Let the $n$-th term be in the $k$-th group, then
$2 n-k=2001$.
Thus, $k=2 n-2001$ is an odd number.
From the above solution, we know $k \leqslant 11$, so $10001006 \geqslant n$.
Therefore, the $n$-th term should be in the 10th group, i.e., $k=10$, which contradicts the fact that $k$ is an odd number. Therefore, $n$ does not exist.