Chris Pollett>Old Classes>PIC 10a, Spring 2000>Practice Final
Although the final can in principle cover any of the material this quarter it will primarily concentrate on material starting section 4.2 in the book. That is, Chapter 4 after 4.2, Ch 5-7, pp. 453-455, 458-462, Ch 9, 589-596, 610-612, Chapter 11. In addition, you should know how to dynamically allocate multidimensional arrays and recall the union type we talked about in class, continue statements and goto. The material in Ch7 on short-circuit evaluation of &&, || and on scoping rules for local variables was covered before the midterm so is less likely to be on the final. The final will be about the same difficulty as this practice final. It will be shorter though having 6 problems rather than 10. One problem from this practice final is guarenteed to be on the final.
Here is how I would study for this final in the order from most to least important... (1) Make sure I understand and can do the problems on the practice test reasonably quickly. (2) Read lecture notes making sure to go over and understand the examples given. Examples are often sources for test problems. (3) Review homeworks and their solutions since midterm. (4) Read the relevant sections from the book.
Practice final questions...
class Book { public: Book( char name[], bool stat); void getName(char copiedName[]); bool getGheckOutStatus(); private: char name[10]; bool checkOutStatus; }Write code for the three member functions of the above class. The constructor should set the name and status of the book object, so getName should use copy the name of the Book object into the array copiedName and getCheckOutStatus should return the check out status of the Book object.
for(int i=0, int j=3;i*j < 5; i++, j=(j+1)%4) { if(i==1) continue; cout << "i: " << i << " j: " << j << endl; }
int *p, *q, v=7; cout << "v:" << v << endl; p =&v; cout << "*p:" << *p << endl; *p = 1; cout << "*p:" << *p << endl; q = new int; *q= 4; p=q; cout << "*p:" << *p << endl;