CS3060 (Spring 2013): Midterm

Variables and Expressions


Part 1

Each question is worth 25 points.

  1. What are constructors and destructors? How do they prevent memory leaks? Why does the garbage collected nature of Java not require a destructor?
  2. Describe the behavior and meaning of new and delete. What are the C analogues?
  3. In C, everything is pass by value. How is pass by reference accomplished in C++ and why is this useful? Why is return by reference useful? Give a specific example.
  4. What is operator overloading? When is operator overloading bad? What is the significance of the friend keyword and why is it relevant to operator overloading

Deliverables

Send your answers in a PDF (do not send a Word Document) to bparks AT uccs DOT edu.