CptS 121 – Program Design and Development September 2, 2019 Your Name: ___________________________ ID#: ___________________________ TA’s Name: ___________________________ Section #: ___________________________ Take Home: Quiz 2 (15 pts) – Introduction to Computer Programming and C NOTE: Submit a hard-copy to your TA in lab this week (along with your solution to Quiz 1)! 1. (2 pts – 1 pt correct type, 1 pt correct initializing) Declare a character variable in C, and set it to the null character. 2. (2 pts – 1 pt correct function, 1 pt for ignoring whitespace) Write a single statement that reads a character from the keyboard. Please do NOT show the prompt statement for this question. All whitespace characters should be ignored by this statement. 3. (2 pts) In your own words, what is a data type? Explain. 4. (6 pts) Provide each result for the following C language expressions. Numbers listed without a decimal point are considered integer values and ones with a decimal point are considered double precision floatingpoint values. a. 27 % 27 =___________ b. 15 / -4 =___________ c. 9.9 / 3 =___________ d. -4 % 9 =___________ e. 13 - 5 * -2 =___________ f. 5.5 – 8 / 6 + 0 * 2 % 45 =___________ 5. (3 pts) What C data types should be used to best represent the following? For each blank, you may list int, double, or char only. These types may be used multiple times. a. The precise number of grams in a pound? ________________ b. The number of friends you have on Facebook? __________________ c. A letter grade in a course? __________________ Instructor: Andrew S. O’Fallon