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 64: | What is a "class"? |
| A collection of objects of various types |
| A description of the structure and functionality of a specific type of object |
| An abstraction of the purpose of an object |
| A description of the structure and functionality of a specific type of object, but with no actual function code (i.e. just prototypes). |
| A link in a directed acyclic inheritance graph |
| Question 65: | What kinds of members can a class have? |
| Data members |
| Data members, function members |
| Data members, function members, children |
| Data members, function members, children, instances |
| Data members, function members, children, instances, friends |
| Question 66: | What is "access" in the context of a C++ class? |
| Whether a given object of the class is accessible at a particular point in the code (this is determined at run-time) |
| Whether a given member of the class is accessible at a particular point in the code (this is determined at run-time) |
| Whether a given object of the class is accessible at a particular point in the code (this is determined at compile-time) |
| Whether a given member of the class is accessible at a particular point in the code (this is determined at compile-time) |
| Whether a given dynamically-allocated object is accessible at a particular point in the code (i.e. whether there is at least one accessible pointer to it) |
| Question 67: | What kinds of access can a class member have? |
| public or private |
| public, protected, or private |
| public, protected, private, or friend |
| Static, dynamic, or late-bound |
| None. Class members aren't accessible because of encapsulation |
| Question 68: | How are classes related to the concept of abstraction? |
| Classes are the C++ mechanism for abstraction of functionality |
| Classes are the C++ mechanism for abstraction of structure |
| Classes are the C++ mechanism for abstraction of functionality and structure |
| Classes are an alternative to abstraction. |
| Classes are an encapsulation mechanism and not related to abstraction at all. |
| Question 69: | How are classes related to the concept of encapsulation? |
| Classes provide an important alternative to encapsulation in C++ |
| Classes provide an important mechanism for encapsulation in C++ |
| Classes provide the only mechanism for encapsulation in C++ |
| Classes encapsulate the object-oriented model |
| Classes are an abstraction mechanism and not related to encapsulation at all. |
| Question 70: | What is a constructor? |
| An operator like new or new[], which creates objects |
| A function which is automatically called whenever an object is created |
| An object which is automatically created whenever a function is called |
| A term for any of the above |
| None of the above |
| Question 71: | Why is a constructor useful? |
| Because it gives us a way of allocating memory dynamically |
| Because it ensures that objects are properly initialized |
| Because it ensures that object stay in their original scope |
| Because it allows us to delay the creation of an object until it is actually used |
| Because is hides the details of object creation from the user |
| Question 72: | What is a destructor? |
| An operator like delete or delete[], which destroys objects |
| An exception which is "thrown" when a fatal error is encountered |
| A function which is automatically called whenever an object ceases to exist. |
| A function which is automatically called whenever a dynamically- allocated object goes out of scope. |
| A function which is can be called to remove any inaccessible dynamically-allocated objects |
| Question 73: | Why is a destructor useful (and sometimes essential)? |
| Because it's the only way to reclaim leaked memory |
| Because it ensures that objects "clean up after themselves" |
| Because it makes it possible to write very subtle code |
| Because it improves the speed of a program, by reducing the number of statements in the source |
| Because objects cannot be destroyed without a destructor. |
| Question 74: | Why can a class have many constructors, but at most one destructor? |
| Because destructors are much more expensive than constructors |
| Because destructors can only be called once, whereas constructors may be called more than once |
| Because the destructor never takes arguments, so the only possible parameter list for a destructor is "(void)" |
| Because destructors are always called at the end of a block, whereas constructors can be called anywhere in the code |
| Because destructors are a negative concept, and Stroustrup wanted to minimize negative influences in C++ |
| Question 75: | The class List::Node has a two parameter constructor: Node(const DataType& data, Node* next) :myData(data), myNext(next) What type of functions are called by myData(data) and myNext(next)? |
| Templated functions |
| Copy constructors |
| Default constructors |
| Default copy constructors |
| Virtual functions |
| Question 76: | The class List::Node has a two parameter constructor: Node(const DataType& data, Node* next) :myData(data), myNext(next) Where is the function called by myNext(next) defined ? |
| In the List class definition |
| In the Node class definition |
| In the DataType class definition |
| In the compiler |
| In the C++ language |
Last updated: August 8, 2005