1. Determine the value of z when each of the algorithm segments below is executed. a) x := 1 y := 0 if (x > 2) then y := 2 * x endif z := 3 * y b) i := 2 if ((i > 1) and (i < 0)) then z := 4 else z := 8 endif c) i := 2 if ((i < 3) or (i > 5)) then z := 1 else z := 0 endif d) x := 0 y := 1 if ((x < y) and (y > 0)) then y := y + 1 x := x + 1 endif z := x * y e) x := 0 y := 4 if (y > 4) then if (x < 1) then x := x + 1 endif z := x * y else if (x < 1) then x := x + 2 else x := x + 1 endif z := (x * y) + 1 endif 2. Consider the algorithm below: q := 0 r := a while (r >= d) do r := r - d q := q + 1 endwhile Determine the values of q and r if prior to execution a and d have the values given below: a) a = 30, d = 7 b) a = 23, d = 4 c) a = 28, d = 9 3. Determine the value of s when each of the algorithm segments below is executed. a) i := 0 s := 0 while (i < 3) do s := s + i i := i + 1 endwhile b) i := 0 s := 1 while (i < 2) do s := 3 * s i := i + 1 endwhile c) i := 1 s := 0 while (i < 5) do if ((i = 2) or (i = 4)) then i := i + 1 else s := s + i i := i + 1 endif endwhile d) x := 1 y := 1 s := 0 while (x < 3) do while (y < 3) do s := s + y y := y + 1 endwhile y := 1 s := s + x x := x + 1 endwhile e) x := 0 y := 1 s := 2 while (x < 2) do while (y < 1) do s := s + y y := y + 1 endwhile y := 1 x := x + 1 endwhile