Final Review All preceeding Chapters (1 - 8) Chapters (9 - 14) Chapter 9: Rewrite the following using set notation: a. (0 < I) AND (I < 25) b. (Ch = 'A') OR (Ch = 'J') OR (Ch = 'K') c. (X = 1) OR (X > 50) AND (X <= 100) Chapter 10: Exam Preparation Exercises: 2, 7, 8 Programming Warm-Up Exercises: 3, 6 What values result from the following function calls? a. PRED(12) b. SUCC('B') c. SUCC(Monday), where Monday is an element of type Days, and Days = (Monday, Tuesday, Wednesday, Thursday, Friday) d. ORD('C') where CHR(1) = 'A' e. CHR(5) where ORD('A') = 1 Define a subrange type or enumerated type (as appropriate) for each of the following: a. Crops consisting of rice, beans, corn, and peas b. All the days of the week c. Workdays Monday through Friday from the tlype in part b d. Range -10 to +200 inclusive e. Characters 'B' through 'K' f. A column counter of the range 1 to 72 Which of the following decaration segments are legal? a. TYPE Color = (Red, Yellow, Blue); Shade = (Light, Dark); b. TYPE Size = (Small, Medium, Large, Giant); Creatures = (Dwarf, Dragon, Giant, Knight); c. TYPE List = ARRAY[1..200] OF Code; Code = 1..10; VAR CodeList : List; d. TYPE Code = 1..5; List = ARRAY[Code] OF INTEGER; VAR CodeList : List; e. TYPE CodeList : ARRAY[1..5] OF INTEGER; f. TYPE Color : (Red, Yellow, Blue); g. TYPE Code = (Fixed, Varying, Mixed); RunType = ARRAY[1..5] OF Code; VAR List : RunType; Mixed : INTEGER; Chapter 11: Exam Preparation Exercises: 1, 2 Write a procedure, SumArray, that receives an ARRAY variable name as a parameter, sums the values in that array, and returns the total to the calling program. Assume these declarations in the main program: CONST TotalLimit = 200; TYPE Totals = ARRAY[1..TotalLimit] OF INTEGER; Note: Other declarations would have to be made before this procedure can be called, but tha's not part of the problem. Chapter 12: Exam Preparation Exercises: 3 Programming Warm-Up Exercises: 1, 2 Declare a string variable, Name, consisting of twenty-five characters. Chapter 13: Exam Preparation Exercises: 5, 7 An array is a collection of identical-type elements referenced by a single name and a subscript. True False Chapter 14: Exam Preparation Exercises: 2, 3, 6, 10, 12 Given the following declarations: TYPE Name = ARRAY[1..25] OF CHAR; Map = RECORD Street : ARRAY[1..2000] OF Name; Park : ARRAY[1..20] OF Name END; City = RECORD CityName : Name; Population : INTEGER; Location : (NE, NW, SE, SW, NC, SC); List : Map END; ListType = ARRAY[1..200] OF City; Box = RECORD Length, Width, Height : INTEGER; Cube : BOOLEAN END; PackingType = ARRAY[1..80] OF Box; VAR CityList : ListType; Carton : Box; Packing : PackingType; ACity : City; AMap : Map; I, Count : INTEGER; Handle : Name; Which of the following would be valid statements in the main program? (Assume valid variables have defined values.) a. ACity := CityList[5]; b. Carton := Count; c. CityList[6].List := AMap; d. Packing.Width := I; e. ACity.CityName[1] := AMap.Street[1]; f. CityList[100].List.Street[1,2] := Handle[2]; g. IF Packing[3].Cube THEN Count := Count + 1; h. IF CityList[20].Location = SW THEN CityList[20].List.Street[1,1] := 'D'; i. ACity. Population := I; j. IF Cube THEN Count := Count + 1; k. I := City.Population; l. ACity.List := AMap; m. IF City.Location = NW THEN Count := Count + 1; n. CityList[1].List.Street[2] := Handle; o. Packing[100].Length := I; p. CityList[20].Street[1] := Handle;