Introduction to Data Structures and Software Engineering
CS1704 : Summer Session II 2000 : Midterm 1
Question One [20]
Eliminate size boundaries of fixed-size variables
More efficient data access techniques
Advantage: smaller compilation units => less time for recompilation during debugging
Disadvantage: hard to keep track of large number of files
Objects are a closer model of the real world so it is easier to
convert real-world solutions to computer programs
Encapsulation and data hiding reduces complexity
This space is required to store the address of the memory associated with the dynamic variable
Question Two [20]
Match the following terms with the most appropriate descriptions:
5000 modules, software engineering, design specification, function prototype, #ifdef, global variable definition, constructor, overloading, pointer variable, dereferencing
_ #ifdef ________________ avoid multiple inclusions of one header file
_ pointer variable ______ memory allocated at compile-time for address only
_ global variable defn __ .CPP file
_ software engineering __ problem, design, program, maintain
_ overloading ___________ set of similar functions
_ constructor ___________ automatic function
_ dereferencing _________ getting from an address to the actual data
_ 5000 modules __________ high cost of integration
_ design specification __ structure chart
_ function prototype ____ header file
Question Three [40]
A class is a data type definition/declaration for an object.
It is called when an object is created. It is usually used to initialize the object.
No. The constructor is called automatically by the compiler, which would not know what to do with a returned value.
const float Pi = 3.14159265359;
class Planet
{
private:
double Radius;
public:
void SetRadius ( double aValue );
double GetRadius ();
double GetVolume ();
Planet ( double aValue );
};
void Planet::SetRadius ( double aValue )
{
Radius = aValue;
}
double Planet::GetRadius ()
{
return Radius;
}
double Planet::GetVolume ()
{
return Pi * Radius * Radius * Radius * 4 / 3;
}
Planet::Planet ( double aValue )
{
SetRadius (aValue);
}
The compiler replaces every call to the function with the (compiled equivalent of the) actual body of the function.
Question Four [20]
Consider the following structure chart for a small program:

No
Yes
Yes
Yes
Output
Data
System call