4------practice2key[1]

4------practice2key[1] - Practice Exam 2 PIC 10A...

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

View Full Document Right Arrow Icon
Practice Exam 2 PIC 10A Disclaimer: Your real exam will be similar to this practice exam in spirit, but of course the questions will not be exactly the same. We’ve covered many topics in the last few weeks, so all topics are not represented on this practice exam. But they're still fair game for Monday's exam. To cover more ground, this practice exam is longer than Monday's exam will be. The exam will focus on material covered since Exam 1, but you are expected to be familiar with all material we have covered in this course. 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 should make an effort to indent in a sensible manner. There are a total of 100 points on this exam. 1.) [5 points] Briefly explain the difference between a member function and a nonmember function. Give an example of a call to each in reference to strings. How does each type of function access variables? A member function is a special helper function associated with a class. It is called with a period following the object name. For example, length( ) is a member function of the string class. string name; int len = name.length( ); A non-member function is not associated with any particular class. For example, we call a non-member function could return a string variable: string name = get_my_name( ); A member function has private (implicit) class variables that can be
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.

Page1 / 12

4------practice2key[1] - Practice Exam 2 PIC 10A...

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