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
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. |
| The index is not being properly incremented |
| There will be an out of bounds error because the loop will ask for too many cookies. |
| There is nothing wrong with this code. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
