CS140 Midterm 1 Grading Guide


Written Exam

  1. (12 points) 2 points for each part. All or nothing.

  2. (10 points) It's roughly 2 points for each part. Mark what is wrong but assign a single grade, rather than 5 separate grades for each part. That way if you think one part should be a half point deduction and another part should be a 1.5 point deduction, you can combine them into a single 2 point deduction.

  3. (8 points) 2 points for part a, 6 points for the student's argument in part b.
    1. all or nothing.
    2. The answer needs to state that constructor (b) with the initialiation lists only requires one constructor call per string variable while the constructor with the assignment statements (the (a) constructor) requires both a 0-argument constructor call and an assignment operation for each string variable. If the student only gives half the argument, such as saying why constructor (b) is efficient without saying why constructor (a) is inefficient, then give 3 points.

  4. (12 points): 4 points per part
    1. 4 points: use your judgement to assign partial credit
    2. 4 points: the critical idea is that the shifting is starting from the left side or front of the vector rather than from the right side or back of the vector. If they make this point in some form, give full credit. They can get partial credit, 2 points, for saying that parts of the original vector are getting clobbered. That observation should be obvious from the diagram. I also want them to get the higher level idea that this problem is caused by starting the shifting from the wrong side of the vector.
    3. 4 points: They need to modify fragment 2. If they modify another fragment without modifying fragment 2, it's 0 points. If they modify fragment 2 and another fragment, deduct 1-2 points depending on how egregious the modification to the other fragment(s) is. If they only modify fragment 2 but get some part wrong, use your judgement to assign partial credit.

  5. (24 points) 1 point for each key in each of the three tables (the separate chaining table in part a is worth 8 points, the quadratic probing table in part a is worth 8 points, and the quadratic probing table in part b is worth 8 points). In part b, give partial credit if they get something wrong early and a subsequent key would be correctly placed based on their earlier misplacement. For example, if they put key 12 in location 2 rather than location 1, then the proper location for key 30 is location 1. If they do that, then key 30 should be counted correct.

  6. (12 points) 3 points for each part.
    1. For part a give 2 points if one of the two binary "blocks" is correct and the other is incorrect.
    2. For parts b-d students can get 2 points for giving the binary representation of the answer rather than the hexadecimal representation. If the student provides an incorrect hexadecimal answer, convert the answer to binary and give 2 points if 1 digit is wrong, 1 point if 2 digits are wrong, and 0 otherwise . If the student provides an incorrect binary answer, give 1 point if 1 or 2 digits are wrong and 0 otherwise.

  7. (5 points) Use your judgement in assigning partial credit. For example, if they forget the "+1", I would deduct a single point. The subtraction operation of 'a' from animal is the key part of this problem and worth 3-4 points.

  8. (10 points) Things to check in the formatting string:

  9. (12 points)

Coding

  1. tail (20 points)
    1. (5 points) handles the command line argument for number of lines to print correctly
    2. (5 points) correctly reads lines from stdin and stores them in a vector
    3. (5 points) computes the correct index in the vector from which to start printing
    4. (5 points) correctly prints the last n lines of the file
  2. teams (25 points)
    1. readTeams (10 points)
      1. (5 points) use an istringstream to break the group string into team members
      2. (3 points) push each team member into either a temporary row vector or else into the new row you've already created in team
      3. (2 points) create a new row in team, either using resize or by pushing a temporary row vector onto team
    2. printTeams (15 points)
      1. (6 points) find the index of the team leader
      2. (7 points) print the team if found
        1. (1 point) fields should be 10 characters wide
        2. (1 point) use .c_str() to print the string
        3. (3 points) print in rows with 3 columns
        4. (1 point) put newline after last row
        5. (1 point) put extra newline after last row
      3. (2 points) if the team is not found, print the designated error message