Given the following pseudocode: Let sumTotal, sumRow, and j be integers sumTotal
ID: 3616628 • Letter: G
Question
Given the following pseudocode:Let sumTotal, sumRow, and j be integers
sumTotal <- 0
for (int i <- 0; i < 5; i++)
sumRow <- 0
j <- 0
while (j < 10)
sumRow <- sumRow+ j
sumTotal <-sumTotal + j
if (i < 3)
j<- j + 2
else
j<- j + 3
print "i = " i ", sumRow = " sumRow ",sumTotal = " sumTotal
What is the output of this pseudocode? (The output ofthe first two iterations is given)i = 0, sumRow = 20, sumTotal = 20
i = 1, sumRow = 20, sumTotal = 40
...
Explanation / Answer
i = 0, sumRow = 20, sumTotal = 20 i = 1, sumRow = 20, sumTotal = 40i = 2, sumRow =20, sumTotal = 60 i = 3, sumRow = 18, sumTotal = 78i = 4, sumRow =18, sumTotal = 96
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.