Computer Science 109:
Computers in Our World

Fall 2008

Princeton University

Brian Kernighan

Computer Science Dept.

Thu Jan 22 13:16:35 EST 2009

Final exam answers

Summary of what we covered

2006 final    2006 answers      2007 final    2007 answers   

Lecture notes:    9/15    9/17    9/22    9/24    9/29-10/1    10/6    10/8    10/13    10/15    10/20    11/3    11/5    11/10    11/12-11/17    11/19    11/24    12/1-12/3    12/8    12/10   

Problem sets:    1     2     3     4     5     6     7     8    

Solutions:    1     2     3     4     5     6     7     8    

Labs:    1     2     3     4     5     6     7     8    

Old stuff:    playlist     lab schedule     Survey results     Lest We Remember     Foxtrot: counting in binary     Megapenny     David Dobkin on NBC News     Toy machine simulator     lab 2 web pages     Javascript examples     2006 midterm      2007 midterm      2006 midterm answers      2007 midterm answers      Voting machine study     Rebuttal report      Diebold Variations      2008 midterm answers      Final exam schedule      COS 109 job opportunity?      GNU GPL      xkcd on Turing computability      Courses after COS 109      Happy birthday, Turing machine      BCD in the news      RSA demo      ATM checksum demo      DMCA 10 years later      Viacom v. Google     

Problem sets, labs and announcements will be posted only on the web page.

You are responsible for monitoring the web page frequently.

Course summary, schedule and syllabus     What was covered in 2007
Comparison of COS 109, 116 and 126   Office hours   Labs   Problem Sets   Exams   Lateness Policy   Collaboration Policy   Textbook   Bibliography

Course Summary

Computers, computing, and many things enabled by them are all around us. Some of this is highly visible, like personal computers and the Internet; much is invisible, like the computers in gadgets and appliances and cars, or the programs that fly our planes and keep our telephones and power systems and medical equipment working, or the myriad systems that quietly collect and share personal data about us.

Even though most people will not be directly involved with creating such systems, everyone is strongly affected by them. COS 109 is intended to provide a broad, if rather high level, understanding of how computer hardware, software, networks, and systems operate. Topics will be motivated by current issues and events, and will include discussion of how computers work; what programming is and why it is hard; how the Internet and the Web operate; and how all of these affect security, privacy, property and other issues. We will also touch on fundamental ideas from computer science, and some of the inherent limitations of computers.

This course is meant for humanities and social sciences students who want to understand how computing works and how it affects the world they live in. No prior experience with computers is assumed, and there are no prerequisites. COS 109 satisfies the QR requirement.

The labs are complementary to the classroom work, though intended to reinforce the basic ideas. They will cover a spectrum of practical applications; two of the labs are a gentle introduction to programming in Javascript.

The course will have fundamentally the same structure as in previous years, but lectures, case studies and examples change every year according to what's happening. Ubiquitous cameras and sites like MySpace and YouTube expose more and more of our private lives, and Viacom's suit against Google and YouTube threatens to expose more. Microsoft and Google are duking it out with each other and with a variety of governments. Skirmishes in the forever war between students and the RIAA/MPAA affect Princeton students all the time. The careless and the clueless continue to do bad things with technology. Oh, yes -- it's an election year and everyone uses computers to vote. What could possibly go wrong? Come and find out.


	 S  M Tu  W Th  F  S
Sep	14 15 16 17 18 19 20	first class
	21 22 23 24 25 26 27	problem set 1 due; lab 1 due
	28 29 30
Oct	          1  2  3  4	problem set 2 due; lab 2 due
	 5  6  7  8  9 10 11	problem set 3 due; lab 3 due
	12 13 14 15 16 17 18	problem set 4 due; lab 4 due
	19 20 21 22 23 24 25	takehome midterm due 5pm (no lab or problem set)
	26 27 28 29 30 31	fall break
Nov	                   1
	 2  3  4  5  6  7  8	problem set 5 due; lab 5 due
	 9 10 11 12 13 14 15	problem set 6 due; lab 6 due
	16 17 18 19 20 21 22	problem set 7 due; lab 7 due
	23 24 25 26 27 28 29	Thanksgiving (starts Thu, not Wed)
Dec	    1  2  3  4  5  6	problem set 8 due; lab 8 due
	 7  8  9 10 11 12 13	last class
	14 15 16 17 18 19 20	winter break
	21 22 23 24 25 26 27
	28 29 30 31
Jan	             1  2  3
	 4  5  6  7  8  9 10
	11 12 13 14 15 16 17	Q/A Sunday 7:00, final exam Friday 7:30 Friend 101
	18 19 20 21 22 23 24


This will evolve over the semester, so check it out from time to time.

Sep 15, 17:    Introduction. What's in a computer

  • Reading: (1) A famous 1945 article by Vannevar Bush, As we may think, is often cited as predicting the Internet and the web. Think about how Bush's "Memex" relates to Google and your computer, and ask yourself what Bush got right and what he totally missed. (2) Apple has introduced a variety of ground-breaking devices, beginning with early personal computers and most recently the iPhone. Read Jonathan Zittrain's chapter on a fundamental difference between them, and think about whether his pessimistic take on the iPhone is still true in the face of the success of Apple's App Store for the newest iPhones, released after Zittrain's essay.
  • Problem set 1, due Sep 24

    Sep 22, 24:    How does it work. Representation of information

  • Reading: (1) Preliminary discussion of the logical design of an electronic computing instrument. Original article by Burks, Goldstine and von Neumann. The first page is a remarkably clear description of how computers are organized, though in archaic terminology. There's no need to read much beyond that, though section 3 is also quite germane. (2) Sections 4 and 5 of Alan Turing's famous essay on whether machines can think, Computing machinery and intelligence, provide an alternative description of how machines operate, not so detailed as von Neumann.
  • Lab 1: Operating systems, SSH, file transfer, a first web page
  • Problem set 2, due Oct 1

    Sep 29, Oct 1:    What the components are and how they are made

  • Reading: Intel web pages on How microprocessors work, how chips are made, and Moore's Law.
  • Lab 2: HTML and web page design
  • Problem set 3, due Oct 8

    Oct 6, 8:    Software and algorithms

  • Reading: a Wikipedia article on algorithms. None of the details matter for the course, but skim it to see the different ways the basic ideas are expressed. (This article is also on the way to becoming an example of what is sometimes called "The Tragedy of the Uncommon": experts add more and more detail that can only be of use to other experts, and thus make the material inaccessible to those with little expertise.)
  • Lab 3: Advanced HTML
  • Problem set 4, due Oct 15

    Oct 13, 15:    Languages, programming; Javascript

  • Reading: some Javascript tutorials, out of many: one, two, three.
  • Lab 4: Graphics
  • Problem set 5, due Nov 5 (after break)

    Oct 20, 22:    Javascript. Operating systems

  • Reading: (1) The late Professor Michael Mahoney's 2007 Freshman seminar on The World of the Computer points to a good collection of interesting reading, including an oral history of Unix.     (2) The Economist has an insightful and interesting article on Microsoft after Gates, with a lot of material on the nature of computing today.
  • Take-home midterm, due Oct 24 at 5 PM. This will be handed out in class on Oct 20. A Q/A session will be scheduled, probably on Oct 19.   
  • No lab, no problem set due this week.

    [fall break]

    Nov 3, 5:    File systems, information storage. Applications.

  • Reading: These articles describe some of the realities of software development: Patriot missile defense system failure, a GAO report; A Bug and a Crash, by James Gleick (who has written numerous other fine technical articles--see the sidebar on this link); the Therac-25 accidents (long and scary); a Mars Rover software problem (more technical, recent). Skim these and think about the many computer systems that we rely on.
  • This is a big year for elections. Browse these items on electronic voting machines, a troubling place to encounter the problems of software development, and hope that nothing could possibly go wrong: EFF page, Summary judgement, security analysis of a voting machine, the Diebold variations.
  • Lab 5: Introduction to Javascript / Programming fundamentals
  • Problem set 6, due Nov 12

    Nov 10, 12:    Networks & communications, Internet

  • Reading: Skim some of the Internet history papers
  • Lab 6: More Javascript / user interfaces
  • Problem set 7, due Nov 19:   

    Nov 17, 19:    World Wide Web

  • Reading: browse around in some ancient Web history. Check out Ed Felten's explanation of net neutrality.
  • Lab 7: Spreadsheets
  • Problem set 8, due Dec 3

    Nov 24, 26:    Threats; security and privacy

  • No problem set or lab this week, but there is class on Nov 26.
  • Reading: what do they know about you? -- general information on privacy; the Electronic Privacy Information Center is also informative.

    Dec 1, 3:    Cryptography; Compression & error detection.

  • Reading: FAQ on cryptography. Good book chapter on public key cryptography. The Heavenly Jukebox, by Charles Mann, an excellent article from the middle of the Napster era, circa 2000. Think about how much has changed since, and how much is the same, but amplified. DRM, spyware and security by Ed Felten and Alex Halderman.
  • Lab 8: ???

    Dec 8, 10:    Intellectual property. Case studies. Wrapup

  • Reading: The Chilling Effects Clearinghouse is an excellent, authoritative site dealing with the legal issues around free speech, intellectual property, and online activities. The Electronic Frontier Foundation also has good coverage of these issues. James Gleick has an interesting but now a bit dated article on software patents. Finally, Your Rights Online at Slashdot points to numerous stories about online rights.
    The original technical paper describing Google. Skip the hard bits, but get the insights. Note the comments about advertising in Appendix A.
  • No more labs or problem sets!

    [winter break]

    Jan xx:    Q/A session. (Depending on interest, this date might move around, and we might arrange for two sessions.)

    Jan 16:    Final exam, 7:30 pm, Friend 101   

  • Note that the final exam date is set by the registrar and I am not allowed to make any individual arrangements. Take this into account when making travel plans.
  • Registrar's Official Exam Schedule page.

    Administrative Information

    Professor: Brian Kernighan, 311 CS Building, 609-258-2089, bwk at cs dot princeton dot edu. Office hours Monday and Tuesday 2:30-4:00, or by appointment, or just drop in if my door is open, which it usually is.

    Teaching Assistants and office hours:

    3pm-4pm: Jialu Huang     CS 213
    4pm-5pm: Xiaobai Chen     CS 413

    10am-11am: Peng Jiang     Carl Icahn Lab 231
    11am-12pm: Chris Park     Carl Icahn Lab 227

    11am-12am: Hanjun Kim     CS 223
    2pm-3pm: Prakash Prabhu     CS 223

    Send mail to with any questions any time.


    Monday and Wednesday 11:00-12:20 in Peyton 145.

    Regular class attendance is expected and class participation helps. Frequent absences are grounds for a failing grade regardless of other performance.

    I won't prohibit the use of laptops in class, but I would be grateful if you could use them primarily for course-related activities like following the notes, rather than for email, chat, YouTube, Twitter, Google, solitaire, poker, eBay, Facebook, or similarly compelling distractions. (Additions to this list are welcome; I can't keep up.)


    There will be eight labs to give hands-on practice in important aspects of computing. The labs are designed to be easily completed within three hours, if you have read through the instructions beforehand, which should take at most an hour. Undergrad lab assistants will be available to help out during scheduled lab sections. Labs are held in the Friend Center; they can be done in dorm rooms or campus clusters, but there will be lab assistants in Friend, and no help elsewhere.

    Labs are together worth about 20 percent of the course grade. To receive credit, students must complete labs by midnight Friday of the week they are assigned, unless there are extraordinary circumstances.

    Labs start the week of September 22. There will be no labs in the week before fall break, Thanksgiving week, or the last week of classes. Lab sessions are PROBABLY Monday through Friday at 1:30 and 7:30 in the basement of Friend.

    Problem sets:

    Eight weekly problem sets, together worth about 20 percent of the course grade, will be assigned. Problems are intended to be straightforward, reinforcing material covered in class and providing practice in quantitative reasoning, and should take 1-2 hours to complete.

    Problem set solutions will be due by 5:00 PM Wednesday, one week after they are assigned. Turn in solutions in the box outside room 311 on the third floor of the CS building, or at the beginning of class. There will be no problem set due in the week before Fall break (midterm instead) or the last week of the term. No credit can be given for late submissions unless there are extraordinary circumstances, and in no case after solutions have been discussed in class.

    Lateness Policy:

    For both labs and problem sets, extracurricular activities and heavy workloads in other classes don't count as "extraordinary", no matter how unexpected or important or time-consuming. And I am unsympathetic to the appeal that "this is my fifth class," since the same could be said of any one of the others.

    Nevertheless, everyone gets truly behind from time to time. In recognition of this, you are allowed two late submissions (no more than 4 days late in each case). Please let us know ahead of time that you will be submitting late so we can keep track.

    You must complete all labs and assignments to pass the course.

    Collaboration Policy:

    You are encouraged to collaborate on problem sets, but you must turn in separate solutions; the names of your collaborators must appear on each submission.

    (This elaboration of the policy on collaboration is paraphrased from COS 126:) You must reach your own understanding of the problem and discover a path to its solution. During this time, discussions with friends are encouraged. However, when the time comes to write down the solution to the problem, such discussions are no longer appropriate -- the solution must be your own work, so you must work on the written assignment on your own. If you have a question, you can certainly ask friends or teaching assistants, but do not, under any circumstances, copy another person's work or present it as your own. This is a violation of academic regulations.

    Another way to look at this: If I asked you to explain how you got your answer, you would have no trouble doing so, because you understood the material completely.


    There may well be short, unannounced, in-class quizzes to verify your existence and test your understanding. These could be worth 5-10 percent of the course grade.

    A take-home, open-book midterm examination will be given during the week before fall break. It will cover material presented and discussed in class and any relevant reading through Wednesday, October 15. It will be worth 20 percent of the course grade.

    An open-book final examination will be given during the fall-term exam period. It will cover all of the relevant readings and material presented and discussed in class. It will be worth 35-40 percent of the course grade.

    There will be question and answer sessions before exams. These are not meant to be an orderly review and are not a substitute for missed lectures, but they are a chance for you to ask questions about course material.

    Sorry: no collaboration on take-home exams or the final.

    Textbook and Readings:

    There is no assigned text for this course; I have never found anything that seems right. Fluency with Information Technology, 3rd edition by Larry Snyder (Addison-Wesley, 2007) is the closest so far, but it's expensive. Notes and readings will be posted online. The weekly readings are for background, context, general education, and/or entertainment. You are not expected to know any of the detailed content, but you should at least understand the general ideas.

    I have half a dozen books that purport to cover the same kinds of areas as the course. None feels right to me, but among them there is coverage of many class topics, so you might find it helpful to browse in them a bit. Available for short term loans; drop in to take a look. Meanwhile, check out the bibliography for other suggestions.