Review Questions for Advanced OOP
Class 1
- Whats wrong with: char Str[128]; Str="Bob";
?
- How do you declare a struct called Date that has integer
members M, D, and Y?
- Whats the difference between malloc and calloc?
- Whats does realloc do?
- How can a function have several return values?
- Given: void Foo( int i ) { i =i*10; } and int x=10;
Foo(x);, What is the value of x?
- What does Polymorphism mean?
- What is a class, and what is an object (or instance)?
Class 2
- How would you use cout to output a string called Name
and an integer named Age?
- What does function overloading mean?
- What is name mangeling?
- For two overloaded functions (same name), how does the compiler
determine which one to call?
- What is a default argument for a function?
- Default parameters must be supplied right to left, or left
to right?
- What syntax rules are there for creating a constructor and
destrucor?
- What is the job of a constructor?
- What is the job of a copy constructor?
- When is a copy constructor invoked?
- What are the 'big 3' member functions for a class?
- What happens if you do not have a copy constructor, and your
object is passed by value to a function?
Class 3
- What operator can not be written for your class?
- Can you create your own operators, like a '$' operator?
- You should be able to write a prototype for all the operators
for a class.
- Given MGString S, S2; MGDate D; and S2 = S + D;
Which operator+ function would be called: MGDate::operator+ or
MGString::operator+
- Can operator functions be overloaded?
- Can operator functions be written outside the class, as non-member
functions?
- The Standard C++ new operator throws an exception
when out of memory: true or false?
- Many older compilers still permit new to return NULL
or 0 when out of memory: true or false?
- You can provide your own new and delete operators
for allocations of your class: True or false?
- What is a static member variable?
- Describe the steps needed to implement a static data
member
Sorry, just a mish-mash of topics:
- What does const mean at the end of a function?
- What is a virtual function?
- What is a pure virtual function?
- What is special about a class with a pure virtual
function?
- What does static mean for a member variable? For a
member function?
- What is the difference between has a and is a?
- In a base and derived class, whose constructor is called
first?
- Whose destructor is called first?
- What is the difference between passing pointers and references?
- What is typeid?
- What is type_info?
- What is RTTI?
- What are the three keywords for exception handling?
- Why would you create an exception class?
- Can exceptions be bested?
- Why might a function have a try/catch block?
- You should be familiar with fstream, istream, ostream, and
strstream
- What is a template class?
- Why would you write a template class?
- Can template classes be derived from normal classes, and
visa-versa?
- Can you name atleast 4 collection classes in the STL?
- Can you name atleast 2 member functions in each?
- What is an iterator, and where are they defined?
- Name atleast 3 algorithm templated functions.