Photo AI

A mathematician has written a program to generate the first six numbers in a mathematical sequence - Scottish Highers Computing Science - Question 5 - 2022

Question icon

Question 5

A-mathematician-has-written-a-program-to-generate-the-first-six-numbers-in-a-mathematical-sequence-Scottish Highers Computing Science-Question 5-2022.png

A mathematician has written a program to generate the first six numbers in a mathematical sequence. The next number in the sequence is the sum of the previous two nu... show full transcript

Worked Solution & Example Answer:A mathematician has written a program to generate the first six numbers in a mathematical sequence - Scottish Highers Computing Science - Question 5 - 2022

Step 1

A

96%

114 rated

Answer

[5, 7, 0, 0, 0, 0]

Step 2

B

99%

104 rated

Answer

[5, 7, 7, 0, 0, 0]

Step 3

C

96%

101 rated

Answer

[5, 7, 7, 12, 0, 0]

Step 4

Re-write Line 14 of the code to generate the correct sequence.

98%

120 rated

Answer

sequence[n] = sequence[n-1] + sequence[n-2]

Join the Scottish Highers students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;