Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following algorithm is given: // Input: n, a number > 2 // Output: a sequenc

ID: 3648313 • Letter: T

Question

The following algorithm is given:

// Input: n, a number > 2
// Output: a sequence of numbers (explicitly printed out)

declare a = 0
declare b = 1
declare c = 0

while n is greater than 0
c = a + b
a = b
b = c;
n = n - 1

print the value of c
end loop

When When this algorithm is executed with input = 5, what would be the output? I.e. what numbers are printed out?

1. 5, 4, 3, 2, 1
2 . 1, 2, 3, 4, 5
3. 1, 1, 2, 2, 3
4. 1, 2, 3, 5, 8
5. 2, 3, 5, 7, 11


What role does indentation have in writing pseudocode?

1) It is used to show which statements following an if-statement are logically grouped together and should be executed either all or none
2) It has the same role as numbering lines
3) It is used to show which statements following a loop definition are logically grouped together, and should therefore be executed all in each round of the loop
4) Both 1 and 3
5) None, it is ignored


Please help me with this two questions,

Explanation / Answer

2 . 1, 2, 3, 4, 5 4) Both 1 and 3

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote