CS260

Examination 3 Guide*


Exam will be closed book and closed notes.

The exam will be comprehensive, but will focus on topics from D&D Chapters 6-9, 11.

  1. Defining class members (data and methods).
  2. constructors (default and otherwise) and destructors
  3. initial values for constructors
  4. referencing structure members (. notation), member selection operator
  5. this pointer and the -> operator
  6. ~ in destructor name
  7. :: scope resolution operator
  8. friend functions
  9. operator overloading (binary only)
  10. Base and derived classes.
  11. Public, private and protected member attributes
  12. Overriding base class members in a derived class
  13. Using dec, oct, hex and setbase qualifiers in I/O.
  14. Structures
  15. Abstract data type (ADT)
  16. Try, throw and catch.
  17. const as a class and variable modifier. That is, the principle of least privaledge.
  18. Static alsss members.
  19. Assert statement.
  20. new, new [], delete, delete [].
  21. Be able to briefly what a copy constructor does.
  22. "is-a" or "is-a-kind-of" and and "has-a" relationships.
  23. No multiple inheritance.

From previous chapters know and understand the following constructs:

  1. Passing parameters by value and reference
  2. Control statements; for, switch, if, if/else, while, do/while
  3. Arithmetic and logical operators (+,-,/,*,++,--,+=,-=,%,...,==,!=,...)
  4. Declarations of arrays
  5. Concepts of precedence and associativity.
  6. break and continue statements/
  7. functions and function prototypes
  8. recursive functions
  9. pointers, use of * and &
  10. basic character manipulation functions; strcpy, strcat, strcmp.
  11. use of const versus #define
  12. Scope of variables.

Example Questions

1.Given the following code:
  ... class definition with operator overloading ...
  define the code to implement overloaded operators for these ______ operators.

2.  Given the following code:
  ... class definitions ...
  create a child class that inherits (overrides) the ______ properities.

3.  Given the following code:
    ... bunch of statements with try, throw and catch .....
  what is the program output

4. Describe in your own words what a copy constructor does.
5. Write a function with the following prototype "char * pal(char *)" that takes a character string as input 
    and returns the string in reverse order.
6. Describe in your own words the difference between the pre and post inctrment operators (i++ and ++i)
7. Given the following code:
   ... parent class definition and implementation ...
  write a child class that does ......
8. Give the ADT properities of .... write a clas that implements the operations ....


* this exam guide is provided as an aid for you in studying for this exam. The topics covered on the exam are shown above. The sample questions shown above represent typical questions that may appear on the exam. There is no guarantee that this exam will have the form or questions that have appeared on exams you have previously taken in this class or in classes offered in previous semesters or that the sample questions offered on this guide will appear on the exam. In reviewing for the exam, consult the following: the text, your class notes and any handouts distributed in class.