Indicate the result(s) of running the following program (on the Worksheet shown
ID: 3809707 • Letter: I
Question
Indicate the result(s) of running the following program (on the Worksheet shown below). Sub Coder Man() Dim b As Single, c As Single, i As Integer b = 2 cells (1, 3).Value For i = 1 To 5 Step 2 c = c + b Cells (i, b + 1), Value = c Next i Cells (1, 3).Value = i, 7 If b c Then Cells (2, 5). Value = 2 Else Cells(2, 5) Value = 3 End If End Sub What is the final value of Cells(1, 3)? What is the initial value of variable i? What is the final value of variable i? What is the final value of Cells(3, 5)?Explanation / Answer
In the initialization, b=0,c=0, i=0
cells(x,y) = value in the shell in sheet row x and column y
Step 1: b = 2+ 2 = 4. (cells(1,3).value = =2)
Step 2: Loop i from 1 to 5
i=1:
c=0+4 = 4
Cells(1,5)=4
i=2:
c=4+4=8
Cells(2,5)=8
i=3:
c=8+4=12
Cells(3,5)=12
i=4:
c=12+4=16
Cells(4,5)=16
i=5:
c=16+4=20
Cells(5,5)=20
Step 3: Cells(1,3) = 5-7 = -2 (i value is 5 from last step)
Step 4: "b not equals c"(b=4,c=20) , first statement executes, Cells(2,5) = 2
Answers:
1. Cells(1,3) = 2
2. Initial value of variable i = 1 (start of the loop)
3. Final value of variable i = 5 (end of the loop)
4. Final value of Cells(3,5) = 12