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:

  1. How is a heap element identified as "active" by the garbage collection mechanism if:
    1. reference counts are used
    2. if the mark/sweep algorithm is used?
  2. Name three strategies for managing the allocation of variable-sized heap storage blocks.
  3. Explain why compaction is necessary.
  4. 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) ;
    }                                      
    
  5. Be able to identify pointer anomalies in a code segment.
  6. Discuss the historical development of abstraction mechanisms in programming languages.
  7. 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.
  8. List the three defining characteristics of object-oriented programming.
  9. 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.
  10. 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()?
  11. 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

  1. Why do compiler families (collections of compilers for several languages and several target architectures) typically employ a common intermediate form?
  2. Why are compilers divided into passes?
  3. Briefly describe the following:
    1. intermediate form
    2. a control flow graph
    3. machine-independant code improvement
    4. target code generation
    5. machine-specific code improvement