Confidential Teaching Materials:
Final Exam Grading Criteria, Page 15 of 17
What is the output of a call to Trace_Array when the array passed to it is:
Position: 1 2 3 4 5 6 7 8 9 10
Value: a k e f o c q s y z
[c13] 10 points
ANSWER:
GRADING:
[p14] 30.0 points
Given the following class public section:
class Set (Data_Type isoftype type)
public:
procedure Add (data_to_add isoftype in Data_Type)
// Purpose: Adds a new piece of data to the set.
// Pre: data_to_add is not already in the set
// Post: data_to_add is added to the set.
procedure Remove (data_to_remove isoftype in Data_Type)
// Purpose: Removes a piece of data from the set.
// Pre: data_to_remove is in the set
// Post: data_to_remove is removed from the set
function Contains returnsa boolean (data_sought isoftype in Data_Type)
// Purpose: Determines whether or not a given piece of data is in the set
// Pre: None
// Post: Returns TRUE if data_sought is in the set, or FALSE otherwise
function Count_Elements returnsa Num()
// Purpose: Returns the number of elements in the set
// Pre: None
// Post: The number of elements in the set is returned.
procedure Initialize()
// Purpose: Initializes a Set object
Write an algorithm that allows the user to manipulate a set of strings. Your algorithm should provide the user
with the following options: