Midterm Exam - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Midterm Exam

Description:

Several students emptied the Queue of its elements. Rather than checking whether the Queue is empty. Checking for queue with one entry, rather than empty ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 7
Provided by: andrew203
Category:
Tags: emptied | exam | midterm

less

Transcript and Presenter's Notes

Title: Midterm Exam


1
Midterm Exam
  • COS 217

2
Midterm Exam
  • Statistics
  • Average score 72
  • Median score 76
  • Range of scores 29-101
  • More detailed breakdown
  • 6 people scored 90-101
  • 15 people scored 80-89
  • 15 people scored 70-79
  • 9 people scored 60-69
  • 14 people scored below 60
  • So, this test was hard, and a little long
  • Quite a few students didnt finish the last
    question
  • Questions 4 and 5 were pretty challenging

3
Common Mistakes
  • Question 1
  • Treating as string concatenation, rather than
    numerical addition
  • E.g., putchar(0 (837 10)) does not print
    07
  • For example, 0 7 is 7, not 07
  • Question 2
  • Misunderstanding the idiom while (s) s
  • The boolean s is true until you reach the \0
    character
  • The s keeps incrementing, one character at a
    time, till \0
  • Meaning of const char
  • Common mistake to assume that the pointer cannot
    change
  • When actually it is the memory contents that
    cannot change
  • Question 3c
  • Not understanding that heap and stack could grow
    in same direction
  • Heap could easily start at one location, and
    stack at another
  • But, this would reduce flexibility in sharing the
    memory space

4
Common Mistakes (Continued)
  • Question 4
  • Certain valid strings were not handled,
    including
  • . Numbers ending with a decimal
    point
  • . Sign followed by a dot
  • E Sign in the exponent
  • Some invalid strings were accepted, including
  • .. Multiple decimal points (or
    Es, or signs)
  • . Just a decimal point, or
    sign with decimal point
  • E. Decimal in the exponent
  • Finally, some did not clearly indicate their DFA
  • A few wrote non-deterministic finite automata
  • Many forgot to label transitions, or mark final
    states

5
Common Mistakes (Continued)
  • Question 5c Queue_empty
  • Misinterpreting the functionality of Queue_empty
  • Several students emptied the Queue of its
    elements
  • Rather than checking whether the Queue is empty
  • Checking for queue with one entry, rather than
    empty
  • Several students checked for queue-gthead
    queue-gttail
  • Rather than checking that the head and/or tail
    are NULL
  • Missed opportunity for concise code (no points
    removed)
  • Return value determined via if/else block
  • Rather than doing return (queue-gthead NULL)

6
Common Mistakes (Continued)
  • Question 5d Queue_add
  • Implementing a stack instead of a queue
  • Adding element to the head, rather than the tail
  • Missing corner case
  • When the queue is initially empty
  • Missing assert after call to malloc()
  • Forgetting the assert() when calling malloc for
    new entry
  • Question 5e Queue_remove
  • Implementing a stack instead of a queue
  • Removing element from the tail, rather than the
    head
  • Missing corner cases
  • Removing an element from an empty queue
  • Removing the last element in the queue
  • Not copying the head entry to enable return of
    the item
  • Not making a separate copy of the head element,
    and item
  • Not doing a free() to return the space used by
    head element
Write a Comment
User Comments (0)
About PowerShow.com