Computer Science 126
Fall 1996

  • What's New · What's Changed
  • Schedule
  • General Information
  • Assignments
  • Lecture Slides
  • Help!

  • What's New?Check the COS 126 Newsgroup

    To get your scores, enter your login: , then click .

    1/22 This page will vanish next week!
    Sometime during the week of 1/27, http://www.cs.princeton.edu/courses/cs126/ will be changed to point to the Spring 1997 offering of COS 126. The pages for the Fall 1996 offering will continue to be available for a few weeks at http://www.cs.princeton.edu/courses/archive/fall96/cs126/.
    1/22 Course grades are in!
    Below on the right is the stem-and-leaf plot of the final course averages. The table on the left is the curve: it maps averages to course letter grades. (An earlier verison of the curve accidently omitted the Bs.)
    >= 90  A+		10 21
    80-89  A		 9 732
    76-79  A-		 8 7754433322111000
    70-75  B+		 7 9988876655544444322211111
    65-69  B		 6 999999877776665555544443332222222211110000
    60-64  B-		 5 99988887777765554444322211000
    50-59  C+		 4 743310
    45-49  C		 3 87611
    40-44  C-		 2 3
    30-39  D		129 scores 65.2 average 65 median
    <= 29  F
    If you have questions about your grade, send email to drh@cs. I'll be out of town from 1/23-2/9, but I will be reading email. Do a finger -l drh@cs to see my schedule.
    1/21 Final exam results
    The exams may be picked up outside Mrs. McDermott's office, room 410. Course grades will be available by 1/22. Before seeking adjustments in your final exam score, please read the solutions. Also, it takes about 6 points on the final to change your course average by 1 point.
    1/20 Solutions to the final exam
    Problem 10 will not be counted, so the exam is worth 95 points. Those who fixed problem 10 received 5 points extra credit.
    1/19 Course Grades
    Check your scores and report errors to drh@cs. Course grades will be computed sometime on Tue. Jan. 21, and the final stem-and-leaf plot and curve will be posted here.
    12/27 Final Exam Factoids
    The final will not cover: Virtual memory, C syntax, UNIX usage, PostScript.
    12/16 Reading Period Office Hours
    Below are our office hours for reading period. Someone will be available everyday between 1/6-17.
    M 1/6 10:30-12 Kostas Tsioutsiouliklis, 317 1/13 10:00-11:30 Patricia Burns, 416
    Tu 1/7 10:00-12 Mariusz Jakubowski, 412 1/14 10:00-12:00 Mariusz Jakubowski, 412
    W 1/8 10:30-12 Kostas Tsioutsiouliklis, 317 1/15 10:00-11:30 Patricia Burns, 416
    Th 1/9 10:30-12 Yefim Shuf, 412 1/16 3:00-4:30 Claire Lin, Equad B227
    F 1/10 10:30-12 Yefim Shuf, 412 1/17 3:00-4:30 Claire Lin, Equad B227
    Reminder: The final exam is on Mon., Jan. 20 at 8:30-11:30 AM in McCosh 50.
    12/10 Assignment 11 now shows the output expected for prot.2 and gene.2.
    12/6 Get a Second Shot at Assignment 10!
    Everyone may submit assignment 10 a second time as assignment 12 by midnight, Fri. 12/13. Use the command
    /u/cs126/bin/submit 12 readme eval.c table.c
    Your score for assignment 10 will be computed as A10 + max(A10,A12), where "A10" is your score on the first submission and "A12" is your score on the second submission. So, if you're confident about your original submission, do nothing! If you'd like a chance to improve your score, polish up your program and submit it again; you have nothing to loose. Here's the exciting part: You won't know A10 before you must submit your second attempt!
    Students who have been given a 2-day extension on assignment 10 can also submit a second copy as assignment 12.
    12/6 Protect Your Files
    You are responsible for keeping your solutions to the COS 126 programming assignments away from prying eyes. If someone else copies your program, we have no way to determine who's the owner and who's the copier; the Discipline Committee gets to decide. Read pages 615-623 in Hahn's Student Guide to UNIX to learn about file permissions. If you execute the command "chmod 700 ." once the next time you log in, your files will be protected. Also, if you add the line "umask 077" to your .cshrc file, only you will be able to access files you create.
    12/2 Stem-and-leaf plot of the current course averages
    11/30 Second Midterm Results!
    If you miss your 12/2 precept, or don't receive your midterm, see Mrs. McDermott in room 410.
    If you think you deserve more points on a problem, email a concise message explaining your case to drh@cs and leave your exam with Mrs. McDermott. If your complaint is about problems 10-15, type your solution into a program and execute it before seeking an adjustment, and include the program in your message.
    11/25 Solutions to the second midterm
    11/19 Updated lecture 18 slides
    Copies will be distributed during the 11/22 precepts; after 11/22, copies will be available in the 2nd floor foyer of the CS Bldg.
    11/16 Second Midterm Factoids
    The second midterm will not cover
    11/7 Passing structures by value
    /u/cs126/examples/rat1.h and /u/cs126/examples/rat1.c illustrate passing and returning structures by value.
    11/7 /u/cs126/bin/lcc now does it all!
    /u/cs126/bin/lcc now automatically looks in /u/cs126/examples, /u/cs126/include, and /u/cs126/lib for include files, source files, object files, and libraries. If you add /u/cs126/bin to your path, you'll never give another lcc -I option. For example, to compile and load /u/cs126/examples/{sort3,intlist,quicksort}.c, which form the example shown in lecture 15, all you need is
    % lcc sort3.c quicksort.c intlist.c
    /u/cs126/examples/sort3.c:
    /u/cs126/examples/quicksort.c:
    /u/cs126/examples/intlist.c:
    And, you can compile your gridclose.c and /u/cs126/examples/print.c with the command
    % lcc gridclose.c print.c
    gridclose.c:
    /u/cs126/examples/print.c:
    11/6 Two ways to avoid typing lots of options to lcc
    1. Use the shell command history described in Hahn, Student Guide to UNIX, pp. 141-145. If you've entered the command
      % lcc -I/u/cs126/examples wf.c /u/cs126/examples/getword.c
      You can execute this again by typing just "!lcc" (read this as "bang lcc"); this causes the shell to run the last command that started with "lcc".
    2. Use /u/cs126/bin/lcc instead of /usr/princeton/bin/lcc. /u/cs126/bin/lcc automatically looks in /u/cs126/include and /u/cs126/examples for include files, and it automatically searches /u/cs126/lib/libmisc.a when it builds an a.out. Thus, the command above can be replaced by
      % /u/cs126/bin/lcc wf.c /u/cs126/examples/getword.c
      And you can re-run this command with "!?lcc" (see Hahn, p. 144). Finally, you can omit the /u/cs126/bin if you add /u/cs126/bin to your path.
    11/1 Midterm Grades
    The COS 126 scores robot now reports your midterm average; use the form below to get your scores and average.
    10/19 Get your COS 126 scores via email!

    Enter your login: , then click , and your scores will be mailed to you.

    10/16 New TOY simulator
    /u/cs126/bin/toy1.14's new -l option prints a "load trace" as your program is loaded into memory.
    10/15 Got some free time? (Yea, sure!) Sneak a peek at future assignments
    Drafts of the assignments appear on the Web at http://www.cs.princeton.edu/courses/cs126/assignments/N.htm where N is the assignment number (note the missing "l" in ".html"). You can peek ahead by opening these URLs with your browser. But don't invest too much effort in getting aheadassignments can change dramatically before they are "published" on the Assignments page, and you're responsible for the published version.
    10/14 Missing in action?
    If you think you're taking COS 126, but your name appears in this list, see Prof. Hanson.
    10/14 First Midterm results!
    If you missed precept, or didn't receive your midterm, see Mrs. McDermott in room 410.
    If you think you deserve more points on a problem, email a concise message explaining your case to drh@cs and leave your exam with Mrs. McDermott. If your complaint is about problems 5-7, type your solution into a program and execute it before seeking an adjustment, and include the program in your message.
    10/12 Correction to the TOY Quick Reference
    The opcodes for right shift (E) and left shift (F) were reversed on the TOY Quick Reference page (now fixed); they are correct in the lecture 8 slides.
    10/11 Class Roster
    Check your name, class, precept, and login information in the class roster; email corrections to drh@cs.
    10/11 Solutions to the first midterm
    10/10 Survey Results!
    10/7 More first midterm practice!
    Take the second practice quiz, which was given to some of the 10/7 precepts. Answers.
    10/6 Confused about assignment 4?
    See the Help! page or the COS 126 Newsgroup.
    10/4 Are you ready for the first midterm?
    Take the practice quiz and find out. (This pop quiz was given in several of 10/4's precepts.) The answers are at the bottom of this page.
    10/3 Contribute to the COS 126 Newsgroup
    COS 126 now has its own "Newsgroup," pu.cs.126. This newsgroup is a forum to which you can contribute your wisdom to your fellow COS 126 inmates. You can post questions to pu.cs.126, expand on previously posted questions, and beat us to the answers. Netscape has a built-in facility for reading and posting news; just click on one of links above. We'll read and respond to messages in pu.cs.126 daily, so browse pu.cs.126 often for the latest bits. You might even find the answer to a burning question before you ask it!
    10/3 First Midterm Factoids
    The midterm will not
    10/2 Email your anonymous comments about COS 126!
    Got more to say about COS 126 than is covered by the survey? Email directed to cs126@cs is forwarded anonymously to the instructor. (Email to just "cs126" or "cs126@phoenix" is not forwarded anonymously.)
    10/2 The survey is here!
    To have your voice heard, complete the survey by 10/10.
    10/2
    The initialization of faces on page 6-6 in lecture 6 is incorrect; it should be the same as on page 6-5. Also, as suggested by a student during lecture and in Sec. 7.10 of Deitel and Deitel, it is possible to use card%4 to represent the suit for card instead of card/13, where card is an integer 0..51. Using card/13 is equivalent to filling the "representation matrix" row-by-row:
              A  2  3  4  5  6  7  8  9 10  J  Q  K
    Hearts    0  1  2  3  4  5  6  7  8  9 10 11 12
    Diamonds 13 14 15 16 17 18 19 20 21 22 23 24 25
    Clubs    26 27 28 29 30 31 32 33 34 35 36 37 38
    Spades   39 40 41 42 43 44 45 46 47 48 49 50 51
    Using card%4 is equivalent to filling this matrix column-by-column:
              A  2  3  4  5  6  7  8  9 10  J  Q  K
    Hearts    0  4  8 12 16 20 24 28 32 36 40 44 48
    Diamonds  1  5  9 13 17 21 25 29 33 37 41 45 49
    Clubs     2  6 10 14 18 22 26 30 34 38 42 46 50
    Spades    3  7 11 15 19 23 27 31 35 39 43 47 51
    In the first case, each sequence of 13 contiguous integers represents a suit; in the second case, each sequence of 4 contiguous integers represents a face.
    9/26 News Flash!
    There are two errors in the assignment 3 Web page (now fixed). In the encryption algorithm, the assignment to j in the loop should read

    j <- (j + Si) mod 256

    That is, use Si, not Sj. In the key initialization loop, the assignment to j should read

    j <- (j + Si + Ki) mod 256

    That is, use Si and Ki, not Sj and Kj.
    9/24
    For an example of how the random module described at the end of lecture 4 is used, browse /u/cs126/examples/testrandom.c, which uses the random function. Notice that testrandom.c includes random.h; you can compile testrandom.c and random.c with the command
    lcc /u/cs126/examples/{testrandom,random}.c
    (You might get a diagnostic about random's type; you can ignore it.)
    9/20 Keep up-to-date the easy way!
    The What's New and General Information pages now have a What's Changed link in their banners. Clicking What's Changed displays a list of COS 126 Web pages that have changed in the last 3 days. Try it! This display also includes a link that generates a Table of Contents for all the COS 126 Web pages.
    9/17
    Here's a sample readme file for submitting pattern.c as a fictitious assignment solution. pattern.c also includes a comment that illustrates the kind of citation that must accompany code or techniques used by others.
    9/17
    You can now browse all of the slides at once in one large Acrobat PDF file (810K). This file includes bookmarks for all of the lectures.
    9/12
    To browse the COS 126 web with version 3.0 of Netscape, type
    /usr/princeton/bin/X11/netscape-3.0 http://www.cs.princeton.edu/courses/cs126/ &
    If you have /usr/princeton/bin/X11 in your path, you can omit the path name above and just type netscape-3.0 ... See the Help! page for instructions on how to configure Netscape 3.0 to use the Acrobat plug-in for browser the lecture slides.
    9/12
    Welcome to COS 126!

    Answers to quiz 1: 1. b 2. b 3. d 4. e 5 b. 6. e 7. c 8. c 9. e 10. b 11. e 12. b.
    Answers to quiz 2: 1. e 2. c 3. T 4. T 5. T 6. T 7. T 8. T 9. F 10. c 11. F 12. F 13. T 14. F 15. d 16. T


    Copyright © 1996 David R. Hanson / drh@cs.princeton.edu
    $Revision: 1.21 $ $Date: 1997/01/22 19:16:06 $