It is important to note that adding such a group is a appearance purposes only.
ID: 3839466 • Letter: I
Question
It is important to note that adding such a group is a appearance purposes only. It is not possible to save out such a group of fairies as a single. .a2c file. Additionally, unlike the list creation process in the earlier parts of chapter, there is no list created as a result of this grouping. It only makes the Object Tree less cluttered and easier to navigate. Summary In programming, many different kinds of organizing structures can be used to create a collection of objects or information about objects. Each kind of structure offers different capabilities or features. In Alice, lists are used as organizing structures (data structures). A list is a collection of several items of the same type (such as Object or Color). In this chapter we looked at creating a list as well as iterating through a list. Alice provides two mechanisms for iterating through a list: sequentially (using For all in order) and simultaneously (using For all together). The For all in order iteration is similar to "walking" (or traversing) through each item in the list, one at a time. The For all together iteration is like setting up a multiway telephone conference call-everyone is on the line at the same time. The For all in order statement is similar to Do in order in that actions are performed in sequence, and the For all together statement is similar to Do together in that actions are performed simultaneously. A common application of lists is searching for item in a list. A list search walks through each item in the list, one at a time, until we find the one we want. Important concepts in this chapter A list is a collection of items. The items in a list all have the same type (such as Object). In Alice, objects in a list do not all need to be instances of the same model. For example, a list containing five rockettes is fine. A list containing three rockettes and two snowwomen is also fine, as both of these are the same type-Object. A list can be iterated through either sequentially or simultaneously. If a list contains objects, and each object is to perform some action, the list item is often passed as a parameter to a method, where the object performs the action. Programming Terms data structure list variable iterate through a list list search Animation Terms For all in order For all together group Questions If an Alice world contains six penguin objects, is it necessarily the case that the six penguins are items in a list of penguins? Explain your answer. What is the purpose of creating a list of similar items in a program? For the programmer, what is the advantage in using a list in a program The list examples in this chapter illustrate lists where the items are all objects. What other types of items could have been used? Which control construct is used to iterate through a list of items in sequence? Which control construct is used to iterate simultaneously (all items in the list at once)? To which of the repetition loop constructs (Loop or While) is the For all in order iteration construct most similar? Explain your choice.Explanation / Answer
1. If an Alice world contains six penguin objects, is it necessarily the case that the six penguins are items in a list of penguins? Explain your answer.
A list holds a group of items. Items may be added to a list and removed from a list while the world is running. A list holds a group of items. Items may be added to a list and removed from a list while the world is running. So it is not necessary to store all six penguins in a same list but by doing so it makes it easier for a programmer for future programming when similar objects are stored under the same list.
2. What is the purpose of creating list of similar items in a program?
A list is simply a way to organize information. Lists are great for coding a group of objects to all do the same thing (either together or in order).
3. For the programmer, what is the advantage in using a list in a program?
One of the simplest of all data structures is a list, which is an ordered set of data. It is often used to store objects that are to be processed sequentially, meaning one at a time in order or on a set of objects.
4. The list examples in this chapter illustrate lists where the items are all objects. What other types of items could have been used?
Queue, Binary tree, Array
5. Which control construct is used to iterate through a list of items in sequence?
For all in order will perform an operation on each item in a list one at a time, beginning with the first item in the list and going through the list in order.
6. Which control construct is used to iterate simultaneously (all items in the list at once)?
For all together will perform an operation on all of the items in a list at the same time.
7. To which of the repetition loop constructs (Loop or While) is the For all in order iteration construct most similar? Explain your choice.
While loop.
The While loop will repeatedly execute the statements inside the loop called the body of the loop) as long as the Boolean condition is true. When the Boolean condition becomes false, the loop is finished.
So setting the Boolean expression to count the number of items in the list and iterating from first object to last one in the list will implement the For all in order construct.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.