Flowchart or Algorithm Tracing Involving Sequences
Interpret a flowchart or algorithmic procedure that iteratively computes terms or sums related to a sequence, and determine the output or fill in missing steps.
Let $S = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \ldots + \frac{1}{100}$. Among the Python scripts below, the one that allows calculating the sum $S$ is: a. \begin{verbatim} def somme_a() : S = 0 for k in range(100) : S =1/( k+1) return S \end{verbatim} b. \begin{verbatim} def somme_b() : S = 0 for k in range(100) : S = S + 1/(k + 1) return S \end{verbatim} c. \begin{verbatim} def somme_c() : k = 0 while S < 100 : S = S+1 /(k+1) return S \end{verbatim} d. \begin{verbatim} def somme_d() : k = 0 while k < 100: S = S + 1/(k + 1) return S \end{verbatim}
7. Executing the flowchart shown in question (7), if the input value of K is 8, then the condition that can be filled in the decision box is A. $\mathrm { s } \leq \frac { 3 } { 4 }$ B. $\mathrm { s } \leq \frac { 5 } { 6 }$ C. $\mathrm { s } \leq \frac { 11 } { 12 }$ D. $\mathrm { s } \leq \frac { 15 } { 24 }$ [Figure]
5. Executing the flowchart shown in Figure 2, if the input is $n = 3$, then the output $S =$ A. $\frac { 6 } { 7 }$ B. $\frac { 3 } { 7 }$ C. $\frac { 8 } { 9 }$ D. $\frac { 4 } { 9 }$ [Figure] Figure 2