midterm1_solutions - August 3, 2009 CS 201 (Intro. to...

August 3, 2009 CS 201 (Intro. to Computing) MIDTERM I 1 2 3 4 5 6 7 TOTAL Name and Last Name : ID : SUNet Username : Notes: a) Please answer the questions only in the provided space after each question. b) Duration is 100 minutes. c) Closed-book, closed-notes, no calculators, no mobile phones and computers. One A4 size cheat-note is allowed. d) There must be eight pages (including this one). Please check it out! QUESTIONS 1) a) (1 point) Write the cout statement (not the whole program; just one statement) that displays your first name, last name, your ID number and your SU email address on the screen. cout << " Gulsen Demiroz, 1480, gulsend" << endl; b) (2 points) What is a constructor? Please circle the correct answer. a) A special member function that constructs a numeric value. b) A special member function that cannot modify a data member. c) A special member function that creates objects of a class. d) A special member function that returns a string. c) (2 points) How many bits are used to represent: (i) a long integer variable? 4 bytes = 32 bits (ii) a double variable? 8 bytes = 64 bits

This preview
has intentionally blurred sections.
Sign up to view the full version.

NAME, LASTNAME: 3) a) (4 points) Fill in the “Message Displayed” column of the following table below according to the given piece of program. Assume that a , b , and c are integer variables. b) (3 points) What is the value of the following expression?

This preview
has intentionally blurred sections.
Sign up to view the full version.