CS61B Quiz (Midterm) Fall 2003, Exams of Data Structures and Algorithms

The fall 2003 cs61b quiz (midterm) for a computer science course. It includes grading standards and answers for each question, as well as common errors and exceptions. The quiz covers topics such as constructors, mutable objects, and recursion.

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shashi_16star
shashi_16star 🇮🇳

4.6

(20)

99 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Fall 2003 CS61B Quiz (Midterm) (25/300 points)
;;;;
Meta
;;;;
GS = Grading Standard
We've tried to include the common errors and grading standard for
every question.
;;;;;;;;;;
QUESTION 1
;;;;;;;;;;
GS: Each question clump tested one idea and was worth 1 full
point. This worked out to roughly two blanks per clump. You started
the question with 7 full points. Any question wrong in a clump lost
the entire clump's points (we write "-1" on your exam). If you missed
*both* questions in a clump, it was scored the same as if you missed
just one. The exceptions to the two-blanks-per-clump were AB (one
clump), E (three clumps) and F (three blanks for one clump).
If you had quotes in your output, you lost 1/2 point -- this was only
deducted once on the entire page. If you've already lost the point for
a clump, we stopped grading (and ignored your extra quotes).
Common errors -- Very few people had every blank correct. Most missed
some trivial errors here and there, pretty much spread across every
question. Most common error: almost one-third of the class lost clump
#7 (f), putting either 10, B or 100 (or all three). About 20 people
missed clump #1.
clump #1
a) 1
b) one
clump #2
c) CD
61CDEF
pf3
pf4
pf5

Partial preview of the text

Download CS61B Quiz (Midterm) Fall 2003 and more Exams Data Structures and Algorithms in PDF only on Docsity!

Fall 2003 CS61B Quiz (Midterm) (25/300 points)

;;;; Meta ;;;;

GS = Grading Standard

We've tried to include the common errors and grading standard for every question.

;;;;;;;;;; QUESTION 1 ;;;;;;;;;;

GS: Each question clump tested one idea and was worth 1 full point. This worked out to roughly two blanks per clump. You started the question with 7 full points. Any question wrong in a clump lost the entire clump's points (we write "-1" on your exam). If you missed both questions in a clump, it was scored the same as if you missed just one. The exceptions to the two-blanks-per-clump were AB (one clump), E (three clumps) and F (three blanks for one clump).

If you had quotes in your output, you lost 1/2 point -- this was only deducted once on the entire page. If you've already lost the point for a clump, we stopped grading (and ignored your extra quotes).

Common errors -- Very few people had every blank correct. Most missed some trivial errors here and there, pretty much spread across every question. Most common error: almost one-third of the class lost clump #7 (f), putting either 10, B or 100 (or all three). About 20 people missed clump #1.

clump #

a) 1 b) one

clump #

c) CD 61CDEF

clump #

d) 25 610

clump #4,5,6 (-1 per wrong answer here)

e) false true false false true R-ERROR

clump #

f) 9 A 105

QUESTION 2

a) GS: 3 pts Start with 3, -1/2 for each incorrect line (min 0)

(1) AD ADE (2) BD BE E (3) E (4) BE B (5) E (6) C CD BC BCD

2 elements each iteration of the loop, but this isn't the case. Only the call to e.nextElement() in the increment part of the for loop is called during each iteration.

QUESTION 3

public int familyFortune() { if (myParent == null) return(myBalance); else return(myBalance + myParent.familyFortune()); }

me.familyFortune());

public static int familyFortuneStatic(Account a) { if (a == null) return(0); else return(a.myBalance + familyFortuneStatic(a.myParent)); }

Account.familyFortuneStatic(me);

Grading Standards:

Starting with 10 points, scores were determined by deducting up to one point per blank (the two blanks around 'me' in both methods were considered one. Both methods were worth up to five points, even tho the second method has six blanks)

  • -1/2 pt for the first instance of a small compile-time error

Examples:

  • Omitting parenthesis in function calls (eg familyFortune vs familyFortune()... only deducted for the first time).
  • Using the wrong variable names (eg parent vs. myParent).
  • Misspelled methods
  • -1 for first instance of severe compile-time errors

Examples:

  • familyFortune(myParent) instead of myParent.familyFortune()
  • Using Integer instead of int as return type
  • Missing Account. in Account.familyFortuneStatic(me)
  • Not making the parameter of familyFortuneStatic() an Account
  • -1 for all instances of run-time errors/statements that generate the wrong output.

Examples:

  • return(0) instead of return balance().
  • Testing myParent.equals(null) (only example of a RT error that only loses a point the first time it was encountered).
  • No points were deducted if the static case does not check that the account passed is null (most people checked that the parent was not null)