Here are a number of practice questions for the final. Although they cover many of the topics we studied in class, they are all presented as `write a function' problems (that's the most requested type of practice problem). 1. Write the strncmp function. Strncmp takes three arguments: two strings, and a length n. It returns zero if the first n characters of the two strings are the same (or if the strings have length less than n and are identical). If the first n characters of the two strings do not match, strncmp should return a negative number if the first string precedes the second one alphabetically, and a positive number if the first string follows the second alphabetically (just as strcmp returns a negative or positive value if its two arguments do not match). You should try to write strncmp recursively. 2. Write the strstr function, as described in the handout for Project 3. You may assume that you have available the strncmp function (as in Problem 1 above) and the strlen function (which returns the number of characters in its string argument). 3. Write the function count_trues which counts the number of array elements for which some condition holds. Count_trues takes three arguments: an array, a count of the number of items in the array (an int), and a predicate which takes one array item as its argument and returns either TRUE or FALSE. Count_trues should return an int representing the number of array entries for which the predicate returns TRUE. 4. Write the function make_even. Make_even takes a list_type as its argument, for which list_item_type has been defined to be int. It returns a new list which has the same number of elements as the argument list. Each even number in the input list appears in the same position in both lists. Each odd number in the input list appears in the same position as twice its value in the output list. For example, make_even should exhibit the following behavior: make_even(<1 2 3 4 5 17 42>) => <2 2 6 4 10 34 42> 5. Write the function height, which returns the number of levels in a binary tree. For example, the empty tree has height zero, a tree with a single node has height one, and the tree: A / \ B C \ D / E has height four. You may use only the types tree_type and tree_item_type, the functions tree_cons, left_child, right_child and tree_data, and the constant the_empty_tree for tree manipulation. 6. Write the function mirror, which builds a binary tree that is the mirror image of its argument. The same tree manipulations as for Problem 5 apply. 7. Write the function stack_weave, which takes two stacks as arguments and returns a new stack that contains all of the elements in both of the input stacks. The elements of the two input stacks must alternate in the result. You may assume that the two input stacks contain exactly the same number of elements. Any item A that lies somewhere above an item B in an input stack must also lie somewhere above item B in the output stack. The input stacks must be returned to their original form before stack_weave returns.