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

The following pseudocode represents a program that needs to collect 7 different

ID: 3819063 • Letter: T

Question

The following pseudocode represents a program that needs to collect 7 different types of cookies and store them in an array. The user will be prompted and asked to enter the names of each cookie. What is wrong with this code? (Note: This pseudocode is meant to be translated into Raptor and not any other programming language.)

Declare one_cookie as string
Declare index as integer
Declare cookies[7] as string
Set index = 1

//Filling the cookies array
until cookies = 9:
     write "Enter one of your favorite cookies: "
     input one_cookie
     cookies[index] = one_cookie
     index = index + 1
end loop

one_cookie is not being placed into the array cookies correctly. The assignment statement is backwards.

Explanation / Answer

wrong with this code:

one_cookie is not being placed into the array cookies correctly. The assignment statement is backwards