Assignment 1, due Aug. 24

Part of the homework for 22C:112, Fall 2012
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 lawyers 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 firstname-lastname@uiowa.edu, but this does not always work, for example, douglas-jones@uiowa.edu 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 hold each of the following: (0.2 points each)

    a) An integer global variable.

    b) An floating point local variable.

    c) A string constant.

    d) A method of a class.

    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) Storing to a statically allocated global integer.

    b) A conditional branch to another instruction in this subroutine.

    c) Loading a local character.

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

    e) Calling 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 cited in lecture 1 (either the tech report or the CACM article -- they are substantially the same; access to the CACM article is free from any on campus computer).

    A question: Parnas uses a vehicle to illustrate the risks and benefits of transparency. What are the instructions that matter to his example in the "lower-level virtual machine" of this example, and what are the corresponding non-transparent instructions in the upper level? (1.0 points)

 

 

Machine Problem I

Due Wednesday, Sep. 5.

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:

-- http://www.divms.uiowa.edu/help/msstart/submit.html

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.