CAT
Exam
Q 57.What does the following Pseudocode trying to do?
Declare an integer variable called n // n is the numberlimit
Declare an integer variable sum // f is the sum
Declare an integer variable f1 // f1 is temporary storage
Declare an integer variable f2 // f2 is temporary storage
set loopcounter to 2 // assigning the variables declared above to
values
set sumto 0
set f1 and f2 to 1
set n to 50
repeat n times
sum = f1 + f2
f2 = f1
f1 = sum
print sum
end loop
Option
A Compute Fibonacci numbers till 51
B Compute Fibonacci number till 50
C Compute Arithmetic Progression from 1 to 50
D Compute Average of numbers from 1 to 51
Read Solution (Total 1)
-
- Answer is Option B
By analyzing the above code the Pseudo code is regarding Fibonacci series.
since initial values are from 1 and n is counted before the entrance of loop the Fibonacci numbers counted up to 50 only.
So the Answer is Option B
- 11 years agoHelpfull: Yes(0) No(0)
CAT Other Question