CS 1044 Spring 1999 Homework 7 Key Q Ans Reason For questions 1 through 3, Mystery() is just a simple linear search function. It searches the array List[] for the first occurrence of Alpha, starting at index 0. Mystery() returns the index at which Alpha was found, or listLength if Alpha is not found. 1 3 29 occurs at index 2 2 6 13 does not occur 3 1 42 occurs at index 0 (and at index 4, but Mystery() never gets there) For questions 4 and 5, just trace the execution of the Binary Search function (as done in class). 4 5 5 2 6 7 As discussed in class. 7 5 3 is invalid becuase PersonRec is a type name, not a variable name. 8 1 As discussed in class. 9 6 2 in invalid because Me is a struct variable, not an array. 10 7 The amount of memory and time is the same for pass by reference as for pass by constant reference. 11 3 1 is invalid because you can't compare arrays with "=="; 2 is an invalid assignment statement. 12 8 1 is invalid because you can't compare struct variables with '=="; 2 is an invalid assignment statement; 3 is invalid because Emp5 and Emp7 are not character strings. 13 2 Personnel[17] is the record stored at index 17. 14 2 15 5 Adding up the sizes of the fields of a PersonRec variable, each would take 63 bytes of storage, so an array of 1000 of them would take 63,000 bytes of storage. 16 2 Not much else to say... 17 5 Trace the execution. 18 4 19 1 Usual struct variable syntax. 20 3 Wood is hierarchical; that is, a Wood variable has a Size field, named Dimensions, which is itself a struct variable.