CS 218 - Object Oriented Programming with C++

Review for Third Test

Students should review the self tests for all chapters covered so far: chapter 11, chapter 12, chapter 13, chapter 14, and chapter 15 on the textbook author's web site. Each time you ask for a self test, you should get 20 random review questions for a chapter. Review each of them several times.

The questions below also provide review for this material. Please review them as well.

  1. What is a struct? How is it created?

  2. How is a struct like an array? How is it different?

  3. How do you assign a value to a member of a struct?

  4. What is the member access operator?

  5. How do you compare the values of two variable of the same struct type?

  6. What are the components of a struct called? What are the components of a class called?

  7. How do declare a variable of a struct type?

  8. What do you call a class object that is created inside a function, and that is destroyed when the function ends?

  9. What do you call a class object that is not destroyed until the program it is in ends?

  10. What is the reserved word that prevents a function from changing a variable that is passed to it by reference?

  11. What is the scope resolution operator? How is it used?

  12. What is a class constructor? What is a class destructor? How many of each may a class have?

  13. What are public and private members? Which is the default for a class? Which is the default for a struct?

  14. What kinds of inheritance does C++ support?

  15. What are classes called that inherit from other classes? What are classes called that other classes are created from?

  16. What are the three memberAccessSpecifiers?

  17. If a base class has public members, how is this reflected in public inheritance by derived classes? How are protected members affected?

  18. If a base class has public members, how is this reflected in private inheritance by derived classes? How are protected members affected?

  19. If a base class has public members, how is this reflected in protected inheritance by derived classes? How are protected members affected?

  20. How are private members treated, regardless of the memberAccessSpecifier?

  21. What is the difference between redefining and overloading an inherited function?

  22. What is the syntax for creating a variable that is a pointer to int? What is the syntax for creating two such variables in the same declaration?

  23. By default, what operations are allowed on pointer variables?

  24. Why is it accurate to describe the name of an array as a constant pointer?

  25. What is the syntax for a function header that allows it to receive a pointer by reference?

  26. Which members of a base class can a derived class never directly access?

  27. What does it mean to override a base class member function? What does it mean to redefine it? What does it mean to overload it?

  28. How do you call a function in a base class if it is overridden in the derived class?

  29. What is the data type of a pointer? Explain your answer.

  30. What is the address of operator? What is the dereferncing operator?

  31. If we have a pointer on the left side of an equal sign, there could be one of four things on the right side of that equal sign. What are they?

  32. Assume a pointer called ptr. What are the possible meanings of:
    • ptr
    • *ptr
    • &ptr

  33. What operator is used to create a dynamic variable? What operator is used to destroy it? What is the operand of such a command?

  34. What are some unusual features about dynamic arrays?

  35. What is a shallow copy? What is a deep copy? How could something go wrong with each of those situations?

  36. Students should review the code examples online and in the text, making sure to understand them. There will be code questions on the test.

  37. What operator is used to overload existing operators in C++?

  38. What are the operators we are told cannot be overloaded?

  39. What is the name of the hidden pointer class objects maintain that points to themselves?

  40. How do you declare a friend function to a class? Is it a member of the class?

  41. If we overload some operators for a class, the overloading function must be a member of the class. What operators is this true for?

  42. What built in operators can be used on classes? What operators can be used on structs?