Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago