key2_f07 - Exam 2 PIC 10A Fall 2007 NAME KEY Check your TAs...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Exam 2, 11/19/07 PIC 10A, Fall 2007 NAME: KEY Check your TA’s name: _____ Jacob _____ Cau _____ Ryan _____ Michael You have 50 minutes to complete this exam. You are not allowed to use any books, notes, calculators, or electronic devices. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code but you are expected to indent appropriately to make your code easier to follow. There are a total of 50 points on this exam. PAGE SCORE POSSIBLE 1 7 2 8 3 9 4 14 5-6 12 TOTAL 50
Background image of page 1

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

View Full Document Right Arrow Icon
1 1.) [2 points] We've seen the reserved word const appear in two situations: in front of a variable declaration and at the end of a member function declaration. Briefly explain what const does in each situation. On a variable, const makes that value constant so that it cannot be changed after its initialization. On a member function, it prevents that function from changing the value of any of the private variables of that class. 2.) [2 points] What does "operator overloading" mean? Give an example of operator overloading that we've seen in this course. Operator overloading refers to defining a symbol (such as "+" or "<") for a class. For example, operator+ was overloaded for the string class so we can concatenate strings: string1 + string2. Another example was in HW7, where we overloaded operator< to compare two cards based on their rank. 3.)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

key2_f07 - Exam 2 PIC 10A Fall 2007 NAME KEY Check your TAs...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online