Out: Mar 15, 2017
Due: Start of lab, weekof March 23, 2017

CENG 251 – Exam Supplemental Makeup Assignment

Eligibility and Limits

The goal here is to allow you to raise your midterm test mark to a maximum of 60%. It requires you to reflect on problems in understanding the test material to help you master the material covered to date. As an added incentive for those who’s test mark is already near to or above 60%, any improved mark above 60% will count as an assignment bonus.
What You Have To Do
On separate sheets of paper provide clearly labelled answersthe questions that you did not receive full marks on and at the end of each of the 4 sections summarize the nature of the errors that you had. You will be given ½ mark for every test mark improvement and up to 1.5 marks for the 5 summaries. There were 25 available marks and the test was marked out of 25. Additionally you may select different questions from the other group’s midterm up to a value of 6 marks. As an example, if you received 10/25 (40%) you would be eligible to receive up to 27/2 (13.5) marks. 5 of these would go to raise your test mark to 15/25. The remaining marks will count as an assignment bonus according to the following formula[i].
You are encouraged to form groups of 2-5 as a study group and discuss answers and problems, but not to hand in the same answers copied from each other.

Hand in your revised answers along with your midterm. The revised answers should be stapled together with a cover page and the midterm should be attached using a paperclip to avoid confusion between the two.
General Comments on Each Section
The comments here refer to both versions of the test.

  1. Definitions

Most of the problems here were vague or incomplete references. Many identified ctype as an include file of declarations but not it’s specific purpose as opposed to other include files. In some cases the description of the Unix kernal could also have matched a discription of a a Unix shell which is a different layer of software.

  1. Functions
    You should refer to Robbins or the appropriate man pages, but rephrase in your own words. Pay attention to the full name of the function – several people missed the n in strncmp/strncasecmp. Pay attention to all the arguments – fgets has 3 arguments though gets has only 1; calloc has 2 arguments, malloc has only one. Many people answered that stat only one argument – the importance of stat is in the 2nd argument which contains the returned value. The extra arguments are an important feature which should be mentioned in your answer. I was also surprised at the number of people who didn’t get atoi which was emphasized both in the C version of the getopt loop and in findPerson.c, access which was focussed on with an example in the lab and errors in the 1st argument of sscanf, which is key to understanding what it does.
  2. Code Fragments
  3. Review getopt loops. The content here was an obvious candidate for a question. It’s something you should know how to do backwards and forwards.
  4. and c. This was was mostly about using string functions to recognize different strings. There were a lot of syntax problems and people seemed not to know how to compare strings using functions. == does not work. Another problem was in discovering the length of a string – many of you thought that string.length() is part of C – it’s not. There was a specific C trick we covered multiple times for determining the length of an array, and this is something I was testing for in both midterms.
    I suggest setting up an array of strings and writing a short program that loops through them. Review the string and character functions and determine which one(s) you could use to detect either the character or characters being looked for – there are multiple possible answers. Question 3b in Midterm B was worth 4 marks – I was looking for 4 features in the answer including correctly determiing the length of the array as 1.
  5. Explanations
  6. mkdir/umask: Modify your program implementing the mkdir command and try it out. Revise your answer according to the results and explain how it works.
  7. getopt/getopts: refer to the posted examples and explain the purpose of each.
  8. data structure diagram for argv: refer to your notes. If you don’t have notes on this you should. We did this at least 3 times.
  9. man page sections: most people did this reasonably well. I’m going to exclude this as an extra question for people who wrote Midterm A - it’s too easy.
  10. Address Arithmetic: Consider the following short program:
    int main()
    {
    short j;
    double mint;
    short * jPtr= &j;
    double *mintPtr=&mint;
    fprintf(stdout,”%p %p %p %p\n”, jPtr, jPtr+1, jPtr+2, jPtr+3);
    fprintf(stdout,”%p %p %p %p\n”, mintPtr+1, mintPtr+2, mintPtr+3);
    }
    This is an example of address arithmetic with different data types. Explain the difference in behaviour.

[i] The assignment bonus will be calculated as follows. extra mark/10. It will be counted as a 7th assignment, but the assignments will be averaged as if there are 6 assignments. Assignment bonus will be capped at a value of .5 assignment.
Example 1: You received 10/25 on the test and receive 20/2 extra marks on account of this makeup. That leaves 5 marks to bring your test mark to 60% and 5/10 as an assignment bonus. While this looks like a 50%, it contributes 5/10 or 3.33% to your final grade or an 8.3% improvement to your assignment average, the equivalent of half an assignment. If you are also in danger of failing the assignment portion of the course this could possibly put you over the top.

Example 2: You received 15/25 on the test and receive 15/2 extra marks on account of this makeup. You aren’t eliglble for an increase in your test mark but you do the exercise. You are elible for 7.5/10 marks as an assignment bonus, but this will be capped at 50% of an assignment.
Example 3: You received 20/25 on the text. Again you will be capped at 50% of the value of an assignment.
Please don’t dwell on the issue of how fair the assignment bonus is – it’s the best I could come up with on short notice. The main purpose is to give some assistance to those who failed the test and incentive to actively review all the questions.