CSE2305 - Object-Oriented Software Engineering
Self Assesment Questions
For each question choose the single response which best answers the question, or which completes the statement most accurately.
Question 82: | What is a "const member function"? |
One which always returns the same value |
One which always returns the same values, given the same arguments (i.e. a "mathematical function) |
One which takes only const (or const reference) parameters |
One which is safe to call on a const object |
One which is safe to call from const object's function members |
Question 83: | Why are such member functions necessary? |
They ensure that constants don't change during execution |
They ensure that member functions don't change during execution |
They ensure that the data of an object doesn't change during execution |
They ensure that the type of an object doesn't change during execution |
None of the above |
Question 84: | What constraints does the compiler put on a const member function? |
It cannot be overloaded, or declared virtual |
It cannot change any mutable data member of the object on which it is called |
It cannot change any non-mutable data member of the object on which it is called |
It cannot call any other non-const member function of the object on which it is called |
It cannot change any non-mutable data member, nor call any other non-const member function, of the object on which it is called |
Question 85: | What is a "mutable data member" |
A mutable data member is one whose value can change (i.e. not a const) |
A mutable data member is one whose value can be changed by a const member function |
A mutable data member is one whose type can change during execution |
A mutable data member is one whose size can change (i.e. a dynamically-allocated array) |
A mutable data member is one which can be optimized away by the compiler |
You should also review Topic 2 questions on typing and inheritance.
Last updated: August 11, 2005