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.
- Defining class members (data and methods).
- constructors (default and otherwise) and destructors
- initial values for constructors
- referencing structure members (. notation), member selection operator
- this pointer and the -> operator
- ~ in destructor name
- :: scope resolution operator
- friend functions
- operator overloading (binary only)
- Base and derived classes.
- Public, private and protected member attributes
- Overriding base class members in a derived class
- Using dec, oct, hex and setbase qualifiers in I/O.
- Structures
- Abstract data type (ADT)
- Try, throw and catch.
- const as a class and variable modifier. That is, the principle of least privaledge.
- Static alsss members.
- Assert statement.
- new, new [], delete, delete [].
- Be able to briefly what a copy constructor does.
- "is-a" or "is-a-kind-of" and and "has-a" relationships.
- No multiple inheritance.
From previous chapters know and understand the following constructs:
- Passing parameters by value and reference
- Control statements; for, switch, if, if/else, while, do/while
- Arithmetic and logical operators (+,-,/,*,++,--,+=,-=,%,...,==,!=,...)
- Declarations of arrays
- Concepts of precedence and associativity.
- break and continue statements/
- functions and function prototypes
- recursive functions
- pointers, use of * and &
- basic character manipulation functions; strcpy, strcat, strcmp.
- use of const versus #define
- 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.