Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q1. What value of COUNT will be output after the instructions corresponding to t

ID: 3671172 • Letter: Q

Question

Q1.

What value of COUNT will be output after the instructions corresponding to the following pseudocode are executed, assuming 7 values - 5, 6, 7, 3, 0, 4, 2 - are input, one on each record?

                  COUNT = 0
                  SUM = 0
                  VALUE = 1
                  DOWHILE VALUE > 0
                        Read VALUE
                        Write Value
                        SUM = SUM + VALUE
                        COUNT = COUNT + 1
                  ENDDO
                  Write SUM, COUNT

a)4

b)5

c)6

d)7

Q2.

What statement(s) are unnecessary in the following pseudocode?

                  COUNT = 0
                  SUM = 0
                  Read VALUE
                  DOWHILE VALUE > 0
                        SUM = SUM + VALUE
                        COUNT = COUNT + 1
                        Read VALUE
                  ENDDO
                  Write SUM

COUNT = 0 and COUNT = COUNT + 1

SUM = 0 and SUM = SUM + VALUE

The first Read VALUE

The second Read VALUE

Q3.

What value of COUNT will be output after the instructions corresponding to the following pseudocode are executed, assuming 7 values - 5, 6, 7, 3, 0, 4, 2 - are input, one on each record?

                  COUNT = 0
                  SUM = 0
                  VALUE = 1
                  DOWHILE VALUE > 0
                        Write Value
                        SUM = SUM + VALUE
                        COUNT = COUNT + 1
                        Read VALUE
                  ENDDO
                  Write SUM, COUNT

4

5

6

7

Q4.

What value of COUNT will be output after the instructions corresponding to the following pseudocode are executed, assuming 7 values - 5, 6, 7, 3, 0, 4, 2 - are input, one on each record?

                  COUNT = 0
                  SUM = 0
                  VALUE = 1
                  Read VALUE
                  DOWHILE VALUE > 0
                        Write Value
                        SUM = SUM + VALUE
                        COUNT = COUNT + 1
                        Read VALUE
                  ENDDO
                  Write SUM, COUNT

4

5

6

7

Q5.

How many times will the loop steps in the instructions corresponding to the following pseudocode be executed, assuming 5 values - 0, 6, 7, 3, 0 - are input, one on each record?

                  DOWHILE SCORE > 0
                        Read SCORE
                        Write SCORE
                  ENDDO

0

5

unknown

infinite

Q6.

How many times will the loop steps in the instructions corresponding to the following pseudocode be executed, assuming 5 values - 5, 6, 7, 3, 0 - are input, one on each record?

                  Read SCORE
                  DOWHILE SCORE > 0
                        Read SCORE
                        Write SCORE
                  ENDDO

0

4

5

infinite

Q7.

How many times will the loop steps in the instructions corresponding to the following pseudocode be executed, assuming 5 values - 5, 6, 7, 3, 0 - are input, one on each record?

                  Read SCORE
                  DOWHILE SCORE > 0
                        Write SCORE
                        Read SCORE
                  ENDDO

0

4

5

infinite

Q8.

How many times will the loop steps in the instructions corresponding to the following pseudocode be executed, assuming 5 values - 5, 6, 7, 3, 0 - are input, one on each record?

                  Read SCORE
                  DOWHILE SCORE > 0
                        Write SCORE
                  ENDDO

0

4

5

infinite

Q9.

How many times will the loop steps in the instructions corresponding to the following pseudocode be executed, assuming 5 values - 0, 8, 6, 3, 0 - are input, one on each record?

                  Read SCORE
                  DOWHILE SCORE > 0
                        Write SCORE
                        Read SCORE
                  ENDDO

0

4

5

infinite

a)4

b)5

c)6

d)7

Explanation / Answer

Q1) b)5

Q)2 a)COUNT = 0 and COUNT = COUNT + 1

Q)3 b)5

Q)4 b)5

Q)5 5 values - 0, 6, 7, 3, 0

0 times

Infinite times

Infinite times

Infinite times

0 times

Q)6

5 values - 0, 6, 7, 3, 0

0 times

Infinite times

Infinite times

Infinite times

0 times

Q)7

5 values - 0, 6, 7, 3, 0

0 times

Infinite times

Infinite times

Infinite times

0 times

Q)8

5 values - 0, 6, 7, 3, 0

0 times

Infinite times

Infinite times

Infinite times

0 times

Q9)

5 values - 0, 6, 7, 3, 0

0 times

Infinite times

Infinite times

Infinite times

0 times