Assignment 1, due Jan. 20

Part of the homework for 22C:112, Spring 2011
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID and on the class list! Assignments are due at the start of class on the day indicated (usually Friday). Exceptions will be by advance arrangement unless there is what insurance companies call "an act of God" (something outside your control). Homework must be turned in on paper, either in class or in the teaching assistant's mailbox. Never push late work under someone's door!

  1. What is your E-mail address? (probably, but this does not always work, for example, is not teaching this course.)

    Homework questions based on prerequisite material

  2. A Question: A typical program uses three memory segments, commonly referred to as the code segment, the stack segment, and the static segment. Identify the segment or segments that would typically holds each of the following: (0.2 points each)

    a) A subroutine.

    b) An integer local variable.

    c) A string constant.

    d) A global variable.

    e) The method table shared by all members of a class in an object-oriented language.

  3. Background: Typical computers include a number of addressing modes. We use absolute addressing, PC-relative addressing, indexed addressing and other modes. For each of the following, indicate the addressing mode most likely to be used. (0.2 points each)

    a) Reference to a statically allocated global variable.

    b) Reference to another instruction in the current subroutine (for example, as used in a conditional branch instruction).

    c) Reference to a local variable.

    d) Reference to a field of the record representing an object.

    e) Reference to a separately compiled subroutine resolved by the linker.

    Homework questions based on new material

  4. Background: Read the article by D.L. Parnas on the concept of transparency (either the tech report or the CACM article -- they are substantially the same).

    a) Why is transparency dangerous. (0.5 points)

    b) Why is transparency useful. (0.5 points)


Machine Problem I

Due Monday, Jan. 30.

Write your own version of the Hello World program in C. Instead of having your program output "hello world" as in Kernighan and Richie, your program should output your name (as it appears on your ID card) and the course number 22C:112. Your program must also include a header comment structured as follows, but with your name inserted appropriately:

     /* MP1 by your name for 22C:060 */

The purpose of this assignment is to get you to use the departmental Linux servers, some text editor, and the C compiler. Your solution must be in a file named mp1.c (all lower case). Submit your solution using the coursework submission tools documented at:


In short, you will type the shell command submit, with no arguments, and when it prompts for a file name, you will type mp1.c, and then an extra carriage return to indicate that there is only one file in your submission. When it prompts for a course, type c_112 and finally, when it prompts for an assignment directory, enter mp1.