7------------key2_f07[1] - Exam 2 PIC 10A Fall 2007 NAME...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 Exam 2, 11/19/07 PIC 10A, Fall 2007 NAME: KEY _____ 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 05/06/12 TOTAL 50 T 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.) [3 points] Briefly explain the difference between value and reference parameters.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course PIC 10A taught by Professor Wittman during the Spring '08 term at UCLA.

Page1 / 12

7------------key2_f07[1] - Exam 2 PIC 10A Fall 2007 NAME...

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

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