COSC 2415 - Data Structures and
ITSE 2445 Data Structures

Bob Comer, Professor of Computer Studies


Exam 1 Review Exercises

Exam 1 will cover Chapters 1-5, and sections 6.1 - 6.3 in Chapter 6. I recommend that you do the following exercises as you study the chapters in the textbook. Answers to the Quick Quiz exercises are in Appendix F at the back of your textbook. Questions marked with an asterisk (*) have answers or additional comments - click here to view them.

The exam will emphasize both C++ coding and concepts. Be sure to review the Summary (Chapter Notes, Programming Pointers, and ADT Tips) at the end of each chapter. Following is a sample question over concepts.

Give a brief description of pass-by-value and pass-by-reference. In what situations should pass-by-value be used? In what situations should pass-by-reference be used?

Chapter 1

Quick Quiz 1.5: 1-2, 4-18.

Other questions and comments

1. How are preconditions and postconditions used?

2. Overview of C++.

Chapter 2

Quick Quiz 2.3: 2-5, 10, 12.

Quick Quiz 2.4: 1-3, 5-15.

Other questions and comments

1. What is a pointer? What does a pointer store? What does it mean to dereference a pointer?

2. How is the new operator used to dynamically allocate memory?

3. Know how to use the typedef statement and what it does.

4. What is data abstraction?

Chapter 3

Quick Quiz 3.2: 1-10.

Add a question like print array element.

Section 3.3 Multidimensional arrays - I will not cover multidimensional arrays on the exam, but this is interesting material.

Quick Quiz 3.4: 1-8, 10.
I will not cover using function names as parameters on this exam.

Quick Quiz 3.5: 1-8.

Other questions and comments

1.* Given the array declaration:

int list[5] = { 10, 20, 30, 40, 50 };
What is output by this statement?
cout << *(list+2) << endl;

2. What is an ADT?

3. What is an array?

4. What is the relationship between arrays and pointers?

5. How do we dynamically allocate an array?

6. How do you use a dynamically allocated array?

7. How do you free the memory used by a dynamically allocated array?

8. Are C-style structs compatible with object-oriented programming?

9. How are C++ arrays and C-style structs similar? How are they different?

Chapter 4

Quick Quiz 4.1: 1-5.

Quick Quiz 4.2: 1-9.

Quick Quiz 4.5: 1-13.

Other questions and comments

1. Know how to write a declaration for a simple class. Why should most data members be private? why should most member functions be public?

2. Know how to write basic mutator (set) member functions. Know how to write basic accessor (get) member functions.

3. Know how to write a constructor for a class. You should be able to write multiple constructors for a class - a default constructor (with no parameters) and constructors with parameters.

4. Know how to overload a "simple" binary operator for a class. See: http://www.austincc.edu/comer/ds10f/binaryop.htm

5. What is the "this" pointer?

6. Know how the assert() mechanism works.

7. What is a const (constant) member function?

8. What is a class invariant?

9. What is information hiding?

Chapter 5

Quick Quiz 5.1: 1-24.

Quick Quiz 5.2: 1-9.

Section 5.4 Pattern Matching - Skip this section.

Section 5.5 Data Encryption - Skip this section.

Other questions and comments

1. know how input and output works in C++ (streams)

2. know some of the basics for using the C++ string class

3. know some of the basics of how to use character arrays (C-strings) to store string data

Chapter 6

Quick Quiz 6.3: 1-16. * Two of the answers in this section are missing, and the rest are mis-numbered, so I have added the answers on the Review 1 Answers page (see above).

Other questions and comments

1. Know how to implement a List class using a "static" array (an array declared as a List member). Pay particular attemtion to how the List items are stored in the array.

2. Know how to declare a List class using a dynamically-allocated array (a pointer to the array is the List member)

3. Know how to write a class descructor function. What is the purpose of a destructor? When is it called?

4. Every class has a copy constructor. If the class programmer does not write a copy constructor, C++ creates a default copy constructor. What is the purpose of a copy constructor? When is it used (called)? What does a default copy constructor do? When does a class programmer need to write a "customized" copy constructor for a class?

5. What does the default assignment operator for a class do? When does a class programmer need to write a "customized" assignment operator for a class?


Return to Data Structures Home Page

Copyright: © 2013 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to:
Bob Comer
Last updated: October 1, 2013