Test questions will be similar to questions in: (1) your
previous exams, (2) your homeworks, and (3) the sample questions
below. The questions on the final may not be identical to any
previously given questions but they will be similar in content.
SAMPLE QUESTIONS FROM CHAPTERS 7 AND 10:
- How is a heap element identified as "active" by the garbage
collection mechanism if:
- reference counts are used
- if the mark/sweep algorithm is used?
- Name three strategies for managing the allocation of
variable-sized heap storage blocks.
- Explain why compaction is necessary.
- In the code segment below, identify which variables will be stored
on the heap and which will be stored on the stack.
void f(void) {
BigTable Tom(300) ;
BigTable *Jerry ;
Jerry = new BigTable(500) ;
}
- Be able to identify pointer anomalies in a code segment.
- Discuss the historical development of abstraction mechanisms in
programming languages.
- Most object-oriented programming languages employ dynamic method
binding for all class methods. Explain why. (b) C++ differs: it makes
static method binding the default, with dynamic method binding
available by means of virtual methods. Explain the rationale for the
C++ designers' choice.
- List the three defining characteristics of object-oriented
programming.
- What are the key distinctions between classes, as found in
Smalltalk, Eiffel, C++, or Java, and type extensions formed via
"module-as-manager" constructs, such as found in Ada 95, Modula-3, or
Oberon.
- Consider the C++ program:
#include
class top {
protected: int a, b;
public: top() {a=1;b=2};
virtual void local() {cout<<a<<endl;};
};
class bottom: public top {
public: bottom() {a=2;b=3;};
protected: void local() {cout<<b<<endl;};
};
main() {
top x;
bottom y;
x.local();
y.local();
}
What is printed for x.local()?
What is printed for y.local()?
- In the program above, what happens if virtual were deleted in the
above definition?
What is printed for x.local()?
What is printed for y.local()?
SAMPLE QUESTIONS FROM CHAPTER 9
- Why do compiler families (collections of compilers for several
languages and several target architectures) typically employ a common
intermediate form?
- Why are compilers divided into passes?
- Briefly describe the following:
- intermediate form
- a control flow graph
- machine-independant code improvement
- target code generation
- machine-specific code improvement