Mathematics 1201: Programming in C Midterm Test 2 Prof. Wickerhauser 19 November 1999 In Problems 1--6 below, find the value of `x' after all of the following statements are executed: Problem 1. #define HUH(x,y) ((x)>(y)?#x:#y) x = HUH(5,-7); Problem 2. int i[]={4,3,2,1,0,-1}, *ptr, x=1; ptr = i; while ( *ptr ) x *= *ptr++; Problem 3. float x, array[99] = {-12}; x = array[12]; Problem 4. int x, a[10]; x = &a[2] - a; Problem 5. #include int x = 'e', y = '\t'; x = isspace(y) ? toupper(x) : 0; Problem 6. typedef struct Link { int Value; struct Link *Next; } *Link; int i; Link Old=0, New; for(i=0; i<100; i++) { New = (Link)malloc(sizeof(struct Link)); New->Next = Old; New->Value = i; Old = New; } for(i=0; i<5; i++) New = New->Next; x = New->Value; Problem 7. Write a complete ANSI C program that reads characters from the standard input until it reaches the end-of-file marker, then returns the number of semicolons read. Be sure to include all the needed standard header files.