Answers for 162 Midterm # 1 02/25/00 Test Form A
1. overloaded
2. Constructor
3. Private (or protected)
4. Persistent
5. Stack
6. Two important points 1) any number of parameters, as long as 2) they are the last ones no parameters without defaults after the ones with defaults. True also: any kind (int, double, char etc)
7. Valid
8. Valid
9. Invalid Value is private, it cannot be accessed in main (or elsewhere outside class). (If Value was in the public section, this code would be valid)
10. 7 5
11. Acct: 1234 Bal 70
Acct: 1234 Bal 40
Acct: 1234 Bal 10
(there is an error message here with contents unknown ok if this is not mentioned)
12. len: 30 flopped: the news today I cant believe
13. Card mycards[5]; (the name of the array is fairly flexible in what it can be, but should not be Card)
14. if (!deck1.isEmpty() ) {
currCard = deck1.draw();
}
(some variability is possible here, but names of variables and functions are specified in the test)
15. for (int cnt = 0;cnt < 20; cnt++){
employs[cnt].GiveRaise(.10);
}
(it is ambiguous whether the call should receive .10 or 10 either is ok)
(counter could be named anything as long as you carry it through consistently)