CS 202, fall 2019 Exam 1 on paper Grading - unless stated otherwise each part is worth 1 point. There are a total of __ points. Please fill in the following. 0) Name: 1) C keywords For this section answer with the appropriate C keyword 1.1) conditional execution (two keywords) 1.2) floating point variable (double precision) 1.3) integer variable that takes up 1/2 as many bytes (one keyword) 1.4) create a register variable (may be faster) 1.5) loop based on a condition (one keyword) 1.6) variable that cannot be modified 1.7) declare a local variable that behaves like a global variable 1.8) character variable 1.9) declare variable from a separate C file 1.10) automatic variable 1.11) stop a loop (skip to after the loop) 1.12) used in place of if/else if/else if/else, four keywords 1.13) declare a structure data type 1.14) used in place of a loop, not recommended for use in C 1.15) floating point variable (single precision) 1.16) number of bytes of a variable or data type 1.17) go back to the beginning of a loop 1.18) loop based on a condition that runs at least once (two keywords) 1.19) integer variable 1.20) define a new data type 1.21) declare a union grouping of data types 1.22) declare an integer that is always non-negative 1.23) integer variable that takes up 2x as many bytes (one keyword) 1.24) loop with init, condition, and increment 1.25) enumerated data type 1.26) stop a function and send back a value 1.27) type of a function that does not return anything 1.28) variable whose value may change at any time even if the C program did not change it 2) C data types For each of the following, give the values for programs compiled with gcc on CS. 2.1) min/max values for int (give the formula) 2.2) # bytes for char 2.3) integer value of '\n' 2.4) integer value of 'A' 2.5) integer value of '0' 2.6) circle which fit within a char: -1000, -200, -100, 0, 100, 200, 1000 2.7) # bytes for short 2.8) integer value of ' ' 2.9) # bytes for unsigned int 2.10) # bytes for float 2.11) min/max values for unsigned int (approximate, to one significant figure) 2.12) min/max values for char (exact) 2.13) integer value of 'a' 2.14) circle which fit within an unsigned int: -100, 0, 1000, 1e6, 1e9, 1e10 2.15) # bytes for unsigned long int 2.16) # bytes for int 2.17) # bytes for double 3) C Expressions. Write down the value of the C expression, and also indicate the new values of any variables that were modified. Assume that the following was executed just before each of the following. Consider each part separately (assume the initialization code was just run). int x = 5, y = 10, z = 15; char c = 5, d = 'a', e = 'A'; float f = 3.14; int A[5] = {1, 2, 3, 4, 5}; char s[6] = "hello"; 3.1) ++x 3.2) s[0] 3.3) d < e 3.4) (x & 1) << 4 3.5) 1 + 2 * 3 3.6) c = d = ++e 3.7) A++ 3.8) x++ 3.9) x && 0 || y 3.10) *(s + 5) 3.11) x = y = z++ 3.12) x < y && y < z || z < x 4) Functions every citizen should know. Note - you don't need to know the process management, threads, or synchronization functions (not yet anyway). 4.1) realloc, meaning of return value 4.2) fprintf, meaning of return value 4.3) free, what it does 4.4) sleep, what it does 4.5) time, meaning of return value 4.6) scanf, meaning of return value 4.7) strlen, type of parameter 4.8) fopen, what it does 4.9) fseek, what it does 4.10) open, difference between it and fopen 4.11) strcmp, meaning of return value 4.12) usleep, difference between it and sleep 4.13) open, meaning of first parameter 4.14) malloc, meaning of return value 5) Data Structures Chart (6 points) Complete the following data structures chart. For each spot, put the best-case and worst-case running time for the operation when the data structure contains n items. Note that for delete you should assume the location or pointer of the item is already known. For stack and queue, for insert/delete put in the info for push/pop and enqueue/dequeue. Array Linked List Stack Queue Hash table Binary search tree Sorted Unsorted balanced not-necessarily-balanced ------------------------------------------------------------------------------------------------------- Insert Lookup Delete 6) Data structures For each data structure and operation listed, give the short description of the algorithm for the operation. 6.1) Ordered array, lookup 6.2) Linked list, insert 6.3) Unordered array, insert 6.4) Unordered array, delete 6.5) Ordered array, insert 6.6) Hash table, lookup 6.7) Binary search tree, lookup 7) Memory Similar to on the quiz...