SI 204 Spring 2017 / HWs


Homework 02: Week 1

Name: _____________________________________________ Alpha: ___________________

Describe help received: ________________________________________________________

  • Due before class on Friday, January 13
  • This is a written homework - be sure to turn in a hard-copy of your completed assignment before the deadline.

Assignment

  1. Note: Many of your homework assignments will include assigned reading from the course notes. This is to prepare you for the next day's class. Frequently (though not always), there will also be some very short problem to help check that you've done the reading. Whether there is a problem or not, it is imperative that you read the assigned material in its entirety prior to class. You won't understand everything perfectly, but this preparation will allow us to make effective use of class time to deepen your understanding and clear up any confusions.
    Required reading: Section 1: "Starting out" and Section 2: "Variables" from the Unit 2 class notes.

    How carefully did you complete the reading? (Circle one)

    Not at all
    Skimmed it
    Read some
    Read all
  2. Consider the following command:
    gcc fun.c -o program
    For each of the following, indicate whether it is a plain-text file, an executable, or neither after executing the command above.
    • gcc: ________________________

    • fun.c: ________________________

    • fun: ________________________

    • program: ________________________

  3. The following program does not compile. Identify the problem(s) and annotate the code to show how to fix it.
    /* This is my awesome program. */
    
    
    int main() {
      fputs("Three");
      fputs("Two");
      fputs("One");
      fputs("Blastoff!");
      return 0;
    }
  4. Even after fixing it so that the program compiles, it probably doesn't do exactly what the programmer intended. What else do you think the programmer forgot to do?

    ___________________________________________________________________