Answers to Questions from TT 6.1 Name: Dipson Aryal Student ID: 105069103 Hand execution using a trace table Demonstrate how the following code is executed in the computer. 1 def whatdoesthisfunctiondo? (data) 2 result := 0; 3 i = 0 4 while i < data. length 5 result := result + data[ i ]; 6 i = i + 1 7 end 8 return result 9 end Draw and complete a trace table for the following two sets of data and place the final result in the table below: data Result [6, -3, 3, 8, 1] [2, 6, -2, 3] Once you have completed your trace tables (below) write the name you chose for the function above: sum_calculate Place your trace tables below: For data set: [6, -3, 3, 8, 1]
1 [6,-3,3, 8, 1]. data length =5. data result 1 0 1 6 -3 6 -3 6 - 3 6 -3 6 -3 6 -3 2 3 3 8 3 8 3 8 3 8 3 8 3 8 4 1 0 0 L 6 T T 3 2 T 6 3 L 14 4 15 5 return= 15.
For data set [2, 6, -2, 3]