REVIEW.TEST2.2001

jaspersugarlandSoftware and s/w Development

Dec 14, 2013 (3 years and 3 months ago)

56 views

AP Comp
uter

Sci
ence
Mr. Haytock


Review Sheet For Test #2

ADT’s

and Dynamic Memory Management



I. Programming
:
review
the Banking project,
LinkedList project


II. Lecture Material:
Anything I’ve said in class is fair game!

The
m
ajor
t
opics

are
:



ADT’s



De
sign
: data and functions, public and private



Implementation

using enum
,
s
truct,
c
lass



Container Classes



Dynamic memory management



Parameters and Addresses



Pointers



Linked Lists and Doubly
-
Linked Lists


III. Reading material
:
review the following readings


Chapter 2.1


2.5


Abstract Data types

Classes and members

Constructors

Using header and implementation files

Classes and parameters

Operator overloading


Chapter 3.1


Container classes and the “bag” class


Chapter 4.1, 4.2; pg. 181


Pointers and dyna
mic memory


Pointers and arrays as parameters


Rules of dynamic classes


Chapter 5.1, 5.2


Fundamentals of Linked Lists


A Linked List Toolkit




What are (at least) 3 special considerations when using dynamic memory management?


a)


b)


c)






IV.
Provi
de a definition for each of the following t
erms
:

Object
-
oriented programming

Abstract Data
Structure

Information hiding

Type casting

Type coercion

Interface /
Header file

Implementation file

Const
ant

reference parameters

Operator overloading

dynamic memor
y allocation

p
ointer

heap

allocate /
de
-
allocat
e

memory

linked list

node

dangling reference

garbage element

m
ember selection operator


In the program that follows, point out one instance of each of the following

(or put NA if not
applicable)
:


Member var
iable

Member function (method)

Modification member

function

Constant member functions

Object / Instance

Activate (a member function)

Scope resolution operator

In
-
line function definition

Constructor

Destructor

Accessor


/* A review program for Exam #2 */


#include <iostream.h>


class Clock

{


private:


int Hours, Minutes, Seconds;


bool IsAfternoon;



public:


Clock(): Hours(12), Minutes(0), Seconds(0), IsAfternoon(false) {}


void Display() const;


void SetHours(int newHours) {Hours = newHours;}

};


void Clock::Display()

const

{


cout << Hours << “ “ << Minutes << “ “ << Seconds;


if (IsAfternoon)


cout << “ in the afternoon” << endl;


else cout << “ in the morning” << endl;

}


void main()

{


Clock ClockOnGround;


Clock ClockInAir;



ClockOnGround.Display();


ClockInAir.SetHours(9);


ClockInAir.Display();

}