Name:
Section:
Question 1:
Please circle true or false.
1. | True False | An operator is just like a regular function (or method), except that it has a funny name. | |
2. | True False | Because we used an array (with a fixed upper bound) in our implementation of the list ADT, the list abstraction represents a fixed-sized collection. | |
3. | True False | C++'s built-in array does not come with built-in bounds-checking or searching routines. It is therefore not a collection. | |
4. | True False | The IntList class could easliy be adapted to maintain a list of objects of any type. | |
5. | True False | A C++ struct is a fixed-size, direct access collection. | |
6. | True False | Although stacks are of theoretical interest in computer science, they rarely get used to write actual programs. | |
7. | True False | A collection is called homogenous when it contains multiple copies of the exact same item. |
#include <iostream.h>Question 3:void printIt( double dvalue ) {
cout << dvalue << endl;
}
void printIt( int ivalue ) {
cout << ivalue << endl;
}int main( void ) {
printIt( 15 );
printIt( 16.01 );
return 0;
}
What is the output of this program?
15
16.01
Name the C++ feature we've discussed that allows you to have multiple functions of the same name in a program.
Overloading
void swap( IntStack& stack )
{
int a = stack.pop();
int b = stack.pop();
stack.push( a );
stack.push( b );
}
list.deleteItem();
list.deleteItem();
list.insertBefore( 15 );
list.advance();
list.insertAfter( 0 );
list.start();
Be sure to indicate the head and tail of the list, as well as the cursor.
Bonus:
What does STL stand for?
The Standard Template Library