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

Predict the result Question 33 -35 are programs expressed as English statements.

ID: 3925963 • Letter: P

Question

Predict the result

Question 33 -35 are programs expressed as English statements. What would each display on the screen if they were actual programs?

33. The variable x starts with the value 0.

       The variable y starts with the value 5.

       Add 1 to x.

       Add 1 to y.

      Add x and y, and store the result in y.

      Display the value in y on the screen.

34. The variable j starts with the value 10.

      The variable k starts with the value 2.

      The variable l starts with the value 4.

      Store the value of j times k in j.

      Store the value of k times l in l.

       Add j and l, and store the result in k.

      Display the value in k on the screen.

35. The variable a starts with the value 1.

    The variable b starts with the value 10.

      The variable c starts with the value 100.

      The variable x starts with the value 0.

      Store the value of c times 3 in x.

      Add the value of b times 6 to the value already in x.

      Add the value of a times 5 to the value already in x.

      Display the value in x on the screen.

Find the Error

36. The following pseudocode algorithm has an error. The program is supposed to ask the user for the length and width of a rectangular room, and then display the room’s area. The program must multiply the width by the length in order to determine the area. Find the error.

            area = width x length.

            Display “What is the room’s width?”.

            Input width.

            Display “What is the room’s length?”.

            Input length.

            Display area.

Explanation / Answer

33) 7

34) j = k*j so j will be 20
l = k*l so l will be 8
k = j+l so k is 28
The value 28 is displayed.

35) a=1,b=10,c=100,x=0
c= 3*x, so c = 0
x += 6*b, so now x will be 60
x += a*5, so now x will be 65
The value 65 is displayed.

36) The area is that the area is calculated before the values of length and width are read from input.