Unformatted text preview:

Object Oriented Programming Using C CLASS 20 REVIEW IDLOOPC1998 1 1 Classes can be organized into an inheritance tree Data and behavior associated with calsses lower in the tree can also be used and accessed by classes higher in the tree TRUE FALSE IDLOOPC1998 2 1 Classes can be organized into an inheritance tree Data and behavior associated with calsses lower in the tree can also be used and accessed by classes higher in the tree FALSE IDLOOPC1998 3 2 The number of elements in a dynamic data structure must be determined before the program is compiled TRUE FALSE IDLOOPC1998 4 2 The number of elements in a dynamic data structure must be determined before the program is compiled FALSE IDLOOPC1998 5 3 An operation performed on a reference variable will not affect the content of the variable referenced TRUE FALSE IDLOOPC1998 6 3 An operation performed on a reference variable will not affect the content of the variable referenced FALSE IDLOOPC1998 7 4 To use the assignment operator to assign an object of a class to another object of the same class the assignment operator must be overloaded TRUE FALSE IDLOOPC1998 8 4 To use the assignment operator to assign an object of a class to another object of the same class the assignment operator must be overloaded FALSE IDLOOPC1998 9 5 The meaning of how an operator works on objects of built in types cannot be changed by overloading TRUE FALSE IDLOOPC1998 10 5 The meaning of how an operator works on objects of built in types cannot be changed by overloading TRUE IDLOOPC1998 11 6 For a derived class object first the base class constructor is called then the derived class constructor is called TRUE FALSE IDLOOPC1998 12 6 For a derived class object first the base class constructor is called then the derived class constructor is called TRUE IDLOOPC1998 13 7 The implementor of a derived class does not need access to the source code of a base class but does need the interface to the base class and the base class s object code TRUE FALSE IDLOOPC1998 14 7 The implementor of a derived class does not need access to the source code of a base class but does need the interface to the base class and the base class s object code TRUE IDLOOPC1998 15 8 Using the stack class from your textbook write a program that evaluates a postfix expression The logic should be as follows Read a postfix expression from the keyboard and save into a string Assume it is valid and in the format 6 2 5 8 4 IDLOOPC1998 16 8 While the character in the string is not equal to 0 If the character is a digit push its integer value onto the stack otherwise if the char is an operator pop the two top elements of the stack onto variables x and y calculate y operator x push the result of the calculation onto the stack Pop the top value of the stack This is the result of the postfix expression IDLOOPC1998 17 9 If you have a pointer as a data member of a class what three functionalities must you add to your class in order to insure proper performance of constructors destructors passing by value and assignments of an object of that class IDLOOPC1998 18 9 If you have a pointer as a data member of a class what three functionalities must you add to your class in order to insure proper performance of constructors destructors passing by value and assignments of an object of that class overloaded assignment operator copy constructor destructor IDLOOPC1998 19 10 Explain why in most cases you should define member functions outside of the class declaration IDLOOPC1998 20 11 What general rule can you give for passing an object to a function by value For passing an object to a function by reference How can you pass an object by reference yet not allow its data members to be changed IDLOOPC1998 21 12 The following header is a use of Circle Circle intx y r Shape1 x Shape2 y some code IDLOOPC1998 22 12 The following header is a use of Multiple Inheritance Circle Circle intx y r Shape1 x Shape2 y some code IDLOOPC1998 23 13 Examine the following portion of a class template and answer the questions template ClassT class TList public TList line 1 TList const TList T LL line 2 TList line 3 TList T operator constTList T LL line 4 IDLOOPC1998 24 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is the first TList T represent in line 4 IDLOOPC1998 25 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is the first TList T represent in line 4 A Return of a reference to an object of type TList T IDLOOPC1998 26 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is the purpose of operator in line 4 IDLOOPC1998 27 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is the purpose of operator in line 4 A Shows that the assignment operator is being overloaded for TList T class IDLOOPC1998 28 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is LL in line 4 IDLOOPC1998 29 13 Examine the following portion of a class template and answer the questions TList T operator constTList T LL line 4 Q What is LL in line 4 A a reference to an object of type TList T passed to the operator function IDLOOPC1998 30 14 What prints from the following code class Base public Base cout Base constructor endl clone virtual void clone cout Base clone called endl class Derived public Base public Derived cout Derived ci onstructor endl IDLOOPC1998 31 14 What prints from the following code main Derivedx Base p x cout Calling clone endl p clone A Constructor Derived Constructor Calling Clone Base Clone Called IDLOOPC1998 32 Question 15 Show the output that would be produced by function main Overhead IDLOOPC1998 33 Question 16 What prints Overhead IDLOOPC1998 34 Q A IDLOOPC1998 35 IDLOOPC1998 36


View Full Document

SMU CSE 2341 - Object-Oriented Programming Using C++

Loading Unlocking...
Login

Join to view Object-Oriented Programming Using C++ and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Object-Oriented Programming Using C++ and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?