There are five problems. Each problem counts 20 points. Write your answers on your own paper. (It's open book.) **** Problem 1. Suppose you had an integer variable I with value 30, a float variable F with value 3.14, and a character variable C with value 'x'. Describe how you could use five different format specifiers to produce the following five lines of output: (a) 00030 3.140 x (b) 30 3.1 'x' (c) 46 3.14e1 "x" (d) 1e 3.14 \x\ (e) $30.00 $3.14 /x/ In each case the line is to be printed using the C statement: printf(FORMAT, I, F, C); The only thing you are to supply is the format string. **** Problem 2. Suppose you have a block of C code beginning with the following declarations and initializations. { int R; int *P; int i = 5; int j = 23; int A[2] = {100, 250, 512}; Describe the effect of executing IN ORDER each of the following six statements: (a) R = i % 2 + 3 * j / 5 ; (b) R = ++A[1] + (i += ++j) ; (c) R = i >> 3 | (~j & 13) ; (d) P = &A[0] ; (e) P += 2; (f) *P = 3; **** Problem 3. In order to speed up the delivery of mail, the United States Post Office is using optical bar codes on mail. One feature of the bar code is a "check digit". No point to go into detail here, but in order to compute the check digit, the computers of the USPO must add up all the digits of the ZIP code. So, if the ZIP code is 28804, the computers add 2+8+8+0+4 to get 22. Your task is to write a function called ComputeSum which takes as its single argument an array of 5 integers containing the digits of the ZIP code and returns the sum of these five digits. Be precise. It should only take about 7 lines of C to do this. **** Problem 4 In a widely-used electronic mail message standard called RFC822, an electronic mail address is represented as: PERSON-NAME that is, a person's real name followed by the name of their computer mailbox enclosed in angle brackets. Your task is to write a function called GetMailbox which takes as its single argument a pointer to a string of characters in RFC822 form and returns a pointer to a string containing the electronic mail box. For example, given the argument: Dean Brock your function should return brock@cs.unca.edu If you use the string functions strchr and strcpy, you can do this problem with about eight lines of C. However, if you do the problem perfectly (that is, without permanently changing the input string), you'll have to use the malloc function and about ten lines of C. **** Problem 5. Suppose you are given the following definitions for C data structures to contain important information about pets. union habit { int sleep; float bark; } ; struct pet { char name[10]; int cat; /* set to 1 for cats, set to 0 for dogs */ union habit timespend; } ; struct pet P; Your task is to write four or five lines of C code for printing out relevant information about the pet mentioned in the C data structure "struct pet". For dogs you should print something like: Snoopy barks 23.83 hours a day where the name of the dog (Snoopy) and the number of hours slept per day is obtained from the struct pet P. For cats, print something like: Garfield sleeps 20 hours a day Be sure to test if the pet is cat or dog before printing the pet information.