CMSC 131 Study Guide - Final Guide: Instance Variable, Duplicate Code, Static Variable

361 views11 pages

Document Summary

I pledge on my honor that i have not given or received any unauthorized assistance on this examination. This exam is a closed-book and closed-notes exam. The exam is a 50 minutes exam. Please use a pencil to complete the exam. There are four problems in the exam. You do not need any import statements for coding questions. You don"t need to use meaningful variable names; however, we expect good indentation. You must stop writing when time is up; make sure you write your name now. Problem #1 (general questions: (3 pts) if the garbage collector stops working which of the following can eventually be exhausted if we continue creating objects. 3 size += x; return name + " " + size; name = new string(namein); size = sizein; private string name; private int size; public fruit(string namein, int sizein) { public void increasesize(int x) { public string tostring() { Fruit other = param; other. increasesize(20); param = null;