For a given rational number $r$, find all integers $z$ such that \[2^z + 2 = r^2\mbox{.}\]

[i](Swiss Mathematical Olympiad 2011, Final round, problem 7)[/i]
1. Let \( r = \frac{p}{q} \) where \( p \) and \( q \) are coprime integers. Then the given equation \( 2^z + 2 = r^2 \) can be rewritten as:
   \[
   2^z + 2 = \left(\frac{p}{q}\right)^2 \implies q^2 2^z + 2q^2 = p^2
   \]

2. Consider the case when \( z > 0 \):
   - Since \( q^2 2^z + 2q^2 = p^2 \), it implies \( p^2 \) is even, so \( p \) must be even. Let \( p = 2p_1 \).
   - Substituting \( p = 2p_1 \) into the equation, we get:
     \[
     q^2 2^z + 2q^2 = (2p_1)^2 \implies q^2 2^z + 2q^2 = 4p_1^2 \implies q^2 2^{z-1} + q^2 = 2p_1^2
     \]
   - If \( z - 1 > 0 \), then \( q^2 2^{z-1} \) is even, and since \( q^2 \) is also even, \( q \) must be even, which contradicts \( p \) and \( q \) being coprime. Therefore, \( z - 1 \leq 0 \), so \( z \leq 1 \).
   - If \( z = 1 \), the equation becomes:
     \[
     q^2 2^1 + 2q^2 = p^2 \implies 2q^2 + 2q^2 = p^2 \implies 4q^2 = p^2 \implies p = \pm 2q
     \]
   - Since \( p \) and \( q \) are coprime, \( q = 1 \) and \( p = \pm 2 \). Thus, \( r = \pm 2 \).

3. Consider the case when \( z = 0 \):
   - The equation becomes:
     \[
     2^0 + 2 = r^2 \implies 1 + 2 = r^2 \implies 3 = r^2 \implies r = \pm \sqrt{3}
     \]
   - Since \( r \) must be rational, there are no solutions for \( z = 0 \).

4. Consider the case when \( z < 0 \):
   - Let \( z = -x \) where \( x > 0 \). The equation becomes:
     \[
     q^2 2^{-x} + 2q^2 = p^2 \implies q^2 + 2^{x+1} q^2 = 2^x p^2
     \]
   - This implies \( 2^x \) divides \( q^2 \). Let \( q = 2^k q_1 \) where \( q_1 \) is not divisible by 2.
   - If \( x = 2k \) (even), then:
     \[
     q_1^2 + 2^{2k+1} q_1^2 = 2^{2k} p^2 \implies q_1^2 (1 + 2^{2k+1}) = 2^{2k} p^2
     \]
     - Since \( q_1 \) is not divisible by 2, \( q_1 = 1 \). Thus, \( q = 2^k \).
     - The equation becomes:
       \[
       1 + 2^{2k+1} = 2^{2k} p^2 \implies p^2 = 2^{2k+1} + 1
       \]
     - This implies \( (p-1)(p+1) = 2^{2k+1} \). The only powers of 2 differing by 2 are 2 and 4, so \( p = \pm 3 \) and \( q = \pm 2 \). Thus, \( r = \pm \frac{3}{2} \).

   - If \( x = 2k+1 \) (odd), then:
     \[
     q_1^2 + 2^{2k+2} q_1^2 = 2^{2k+1} p^2 \implies q_1^2 (1 + 2^{2k+2}) = 2^{2k+1} p^2
     \]
     - Since \( q_1 \) is not divisible by 2, \( q_1 = 1 \). Thus, \( q = 2^{k+1} \).
     - The equation becomes:
       \[
       1 + 2^{2k+2} = 2^{2k+1} p^2
       \]
     - This is a contradiction modulo 4, so there are no solutions for \( x = 2k+1 \).

Conclusion:
The solutions to \( (r, z) \) are \( (\pm 2, 1) \) and \( \left(\pm \frac{3}{2}, -2\right) \).

The final answer is \( \boxed{ (\pm 2, 1) } \) and \( \left(\pm \frac{3}{2}, -2\right) \).