COS 126 Quiz 1 1) ___ is responsible for processing of the following line: #include a) editor b) preprocessor c) compiler d) (b) and (c) e) CPU 2) Preprocessor runs immediately before ___ . a) editor b) compiler c) linker d) all of the above e) (a) and (c) 3) ___ creates a.out a) editor b) preprocessor c) compiler d) linker e) none 4) Which of the following standard devices are typically associated with the computer screen? a) stdin b) stdout c) stderr d) (a) and (b) e) (b) and (c) 5) What MUST appear in every self-contained C program? Hint. What happens when you run any program? a) #include b) { c) return; d) (a) and (b) e) (a), (b), and (c) 6) Which of the following are escape sequences? a) \n \t \r \v b) \a c) \\ \" d) (a) and (b) e) (a), (b), and (c) 7) Which of the following are "good" names for variables in a program? a) 1stNumber b) #ofBooks c) sum_of_numbers d) xRgg-Uds27 e) (a), (c), and (d) 8) In the following fragment of code, declarations of which variables are incorrect? /* int k; */ int u; int main() { int a, bb = 7; a = 5; int cc = a + bb; while(1) { printf("Hello \n"); int ss; } return 0; } /* int q; */ a) k, q and cc b) ss, cc, and bb c) cc and ss d) u e) All declarations are incorrect because is not included. 9) The following program was designed to prompt a user to enter two numbers, read them in, and find their sum. Will it work? #include int main() { int x, y = 1; scanf("Please enter two integers %d \n", &x); scanf("%d", y); printf("The sum is %d", -( -x - y)); return 0; } a) Yes. This program does what it is supposed to do. b) No. The variable x is not initialized and 'y' is not zero. c) No. The printf statement prints the difference instead of the sum. d) No. We need a temporary variable to hold the sum. e) No. It will not work because of some other reasons. 10) What is the value of yy? int xyzx = 32767; int yy = 50 - (10 + 2 * 10 + 32 / 10 - 13) % 4 + (10 % 5) * xyzx; a) It cannot be evaluated correctly because 'xyzx' is too large b) 50 c) 48 d) 46 e) none 11) Please evaluate the following expression. 20 % 3.5 a) 7 b) 6 c) 5 d) approximately 5.7 e) none 12) What will be printed after this block is executed? ... { int x = 2; if( x = 3 ) printf("x is not 2"); else printf("x is 3"); } ... a) It will not compile. We forgot to add a semicolon at the end of if(x=3) b) "x is not 2" c) "x is 3" d) It will compile but will not print because x is 2 and not 3 e) "x is not 3"