SmarterEd

Aussie Maths & Science Teachers: Save your time with SmarterEd

  • Login
  • Get Help
  • About

Calculus, SPEC2 2023 VCAA 6 MC

Consider the following pseudocode.

define \(f(x, y)=e^{x y}\)

\(\begin{aligned} & x \leftarrow 0 \\ & y \leftarrow 0 \\ & h \leftarrow 0.5 \\ & n \leftarrow 0\end{aligned}\)

while \(n \geq 0\)

\(\begin{aligned} & y \leftarrow y+h \times f(x, y) \\ & x \leftarrow x+h \\ & n \leftarrow n+1\end{aligned}\)

print \(y\)

end while

After how many iterations will the pseudocode print 2.709 ?

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
Show Answers Only

\(C\)

Show Worked Solution

\(\text{1st iteration:}\ 0+\dfrac{1}{2} \times e^0=\dfrac{1}{2} \)

\(\text{2nd iteration:}\ \dfrac{1}{2} +\dfrac{1}{2} \times e^{\frac{1}{4}}=1.142… \)

\(\text{3rd iteration:}\ 1.142 +\dfrac{1}{2} \times e^{1 \times 1.142}=2.7085… \)

\(\Rightarrow C\)

Filed Under: Euler, Pseudocode and Slope Fields Tagged With: Band 4, smc-1183-15-Pseudocode

Copyright © 2014–2025 SmarterEd.com.au ยท Log in