CS140 -- Labs

Adapted from James Plank's CS140 course

Helpful Documents

  1. gdb--C debugger
  2. vi--text editor

Lab Assignments

Homework assignments are now in a separate table that appears after the lab assignments.

Lab Due Date Grading Guide Status
Lab 1 11:59PM, Friday, January 28 guide Ready
Lab 2 11:59PM, Tuesday, February 1 guide Ready
Lab 3 11:59PM, Sunday, February 13 guide Ready
Lab 4 11:59PM, Sunday, February 20 guide Ready
Lab 5 11:59PM, Tuesday, March 1 guide Ready
Lab 6 11:59PM, Tuesday, March 8 guide Ready
Lab 7 11:59PM, Tuesday, March 29 guide Ready
Lab 8 11:59PM, Tuesday, April 5 guide Ready
Lab 9 11:59PM, Thursday, April 14 guide Ready
Lab 10 11:59PM, Thursday, April 28 guide Ready

Homework Assignments

All homework assignments are due at the beginning of your lab section.

AssignmentSolutionsDue Date
hw1 solutions Jan. 19
hw2 solutions Jan. 26
hw3 solutions Feb. 2
hw4 solutions Feb. 9
hw5 solutions Feb. 16
hw6 solutions Feb. 23
hw7 solutions Mar. 2
hw8 solutions Mar. 9
hw9 solutions Mar. 16
hw10 solutions April 6
hw11 solutions April 13
hw12 solutions April 20
hw13 solutions April 27

Lab Sections

Date Room
Wednesday 8:00Claxton 103
Wednesday 11:15Claxton 103

General Stuff

Lab attendance is mandatory for the entire time of the lab, unless you have already submitted the lab. If a lab is a multi-week lab you must attend each lab until you complete and submit the lab. In the past I have not made lab attendance mandatory beyond the beginning of lab but I have found that too many students do not budget their time well, procrastinate, and do not make any meaningful progress on the lab. Thus it is required that you attend and work on the lab during the lab period. If you have a time conflict throughout the semester (e.g., a class conflict) that does not allow you to attend the entire lab period please get an excused absence from me.

Labs are due at the same time, regardless of the lab in which you are enrolled. The TA's will let you know how to submit your lab work.

Late Labs

You are allowed one late lab without penalty. Notify your lab TA before the lab deadline that you plan to take your late lab. You will have 3 days from the due date to complete the lab. After your first late lab all subsequent late labs will receive a grade of zero unless you have a compelling, written excuse from someone such as a doctor. The reason for this policy is that I want you to hand in whatever you have completed with a lab and move on to the next one. In the past when I have permitted late labs with a per day penalty students have fallen hopelessly behind trying to complete labs and have ended up with extremely low lab averages.

The one late lab policy makes it imperative that you do not procrastinate and start your lab a day or two before the deadline. I will not look kindly upon excuses that the computers in the labs crashed a couple hours before the deadline. If you plan your time wisely you will have your lab mostly complete a day before the lab is due.

Commenting Your Code

You will be graded on commenting. Something like 15%. You should comment your code by blocks of comments at the beginning of your files, and before subroutines. Variables should be commented inline. You may also want to comment large blocks of code. You should not comment with a ``running commentary'' to the right of your code, because that is often useless, hard to maintain, and disconcerting. I have seen comments like the following:
  if (i == 0) {               /* If i equals zero */
    return;                   /* then return */
  } else {                    /* otherwise */
    exit(1);                  /* exit with a value of one */
The above is an extreme example, but don't let it happen to you.

Here's an example of what I would consider a well documented program:

#include < stdio.h >

/* sumnsquared.c
   Jim Plank
   August 23, 1998

   This program prompts for and reads a value n from standard
   input, and then calculates and prints the sum of squares
   from one to n.  It uses a for loop instead of using the 
   closed form expression.

  int n;                   /* The value */
  int sum;                 /* The running sum of squares */
  int i;                   /* An induction variable */

  /* Prompt for and read in a value of n */

  printf("Enter a value n: ");
  if (scanf("%d", &n) != 1) {
  /* Calculate sum for each value of i from one to n */

  sum = 0;
  for (i = 1; i <= n; i++) sum += (i*i);

  /* Print the final summation */

  printf("%d\n", sum);