Difference between revisions of "CSC231 Homework 6 Fall 2017"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- =Problem 1= <br /> * Assume that you have a program that uses a loop to compute Fibonacci numbers. * The Fibonacci terms get stored in an array called Fib as the...")
 
(Problem 1)
Line 12: Line 12:
 
<br />
 
<br />
 
* The program uses some form of addressing mode to store each '''Fib[i]''' term in the array.
 
* The program uses some form of addressing mode to store each '''Fib[i]''' term in the array.
* If we are not worried about possible overflow of the arithmetic, i.e. we are not worried that the computation might become invalid at some point, and if we assume that the array can be as large as we want (we have a large amount of RAM in our computer), '''what is a good approximation to the number of Fibonacci terms an assembly program can compute in 1 second, if our computer has a 2.5 GHz Pentium processor?'''
+
* If we are not worried about possible overflow of the arithmetic, i.e. we are not worried that the computation might become invalid at some point, and if we assume that the array can be as large as we want (we have a large amount of RAM in our computer), '''what is a good approximation to the maximum number of Fibonacci terms an assembly program can compute in 1 second, if our computer has a 2.5 GHz Pentium processor?'''
 
* Answer the multiple-choice question on Moodle.
 
* Answer the multiple-choice question on Moodle.
 
<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
<br />

Revision as of 13:01, 5 November 2017

--D. Thiebaut (talk) 12:59, 5 November 2017 (EST)


Problem 1


  • Assume that you have a program that uses a loop to compute Fibonacci numbers.
  • The Fibonacci terms get stored in an array called Fib as they are computed. The array is an array of dwords.
  • In the loop, the program computes


           Fib[ i ] = Fib[ i-1 ] + Fib[ i-2 ];


  • The program uses some form of addressing mode to store each Fib[i] term in the array.
  • If we are not worried about possible overflow of the arithmetic, i.e. we are not worried that the computation might become invalid at some point, and if we assume that the array can be as large as we want (we have a large amount of RAM in our computer), what is a good approximation to the maximum number of Fibonacci terms an assembly program can compute in 1 second, if our computer has a 2.5 GHz Pentium processor?
  • Answer the multiple-choice question on Moodle.