Computer Science 109:
Computers in Our World

Fall 2022

Princeton University

Brian Kernighan

Computer Science Dept.
Mon Dec 26 14:34:52 EST 2022
Problem sets, labs and announcements will be posted on this web page only.
You are responsible for monitoring this page.

Final exam answers

Lecture notes:    9/7     9/12     9/14     9/19     9/21     9/26     9/28     10/3     10/5     10/10     10/12     10/24     10/26     10/31 11/2     11/7     11/9     11/14     11/16     11/21     11/28     11/30     12/5     12/7    

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        

Office hours:    BWK: Mon and Wed after class, Fri 12:30-2:30; other times can be easily arranged, as can Zoom meetings.
                           Archie McKenzie '24 (archiem@) Wed and Sun 6:00-9:00 Zoom link
                           Grading: Chloe Qiu (shiyunq@)

Old stuff:    playlist     survey     list of information breaches     Semiconductors in the news     Babbage's Difference Engine     How to turn off phone tracking     Lab 1 pages     Lab 2 pages     Phish bowl     Turing Machine simulator     Color display program     Toy simulator     Lab 3 pages     Archie's game for learning hex, binary, decimal     2021 midterm      (2021 answers)      2020 midterm      (2020 answers)      2022 midterm answers      Obituary of Kathleen Booth      Year 2038 problem      Python examples      Potential research assistant positions in digital humanities      Open source voting machines in NH      IP on avian carriers      (Wikipedia entry)      Lab 7 web pages      Comments on lab 6      Remember Z-lib?      Enigma simulator      Your cellphone is a spy!      New SI units      Units suggested by class members      FB commercial surveillance      FCC frequency allocation chart      ATM and ISBN checker      chatGPT in the comics      chatGPT takes a midterm      Summary of what we covered      2021 final       2021 answers       2020 final       2020 answers      

Quick links:    Course summary, schedule and syllabus       Textbook       Problem sets       Labs       Lateness policy       Collaboration policy       Exams and grades

Course Summary

Computers, computing, and the many things enabled by them are all around us. Some of this is highly visible, like laptops, phones 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, share and sometimes reveal vast amounts of 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 high-level understanding of how hardware, software, networks, and systems operate. Topics will be motivated by current events and concerns, and will include discussion of how computers are built and operate; programming and programming languages; the Internet and the Web; artificial intelligence and machine learning; cryptography; and how all of these affect privacy, security, property and other important 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 computers and communications systems work and how they affect the world we live in. No prior experience with computers is assumed, and there are no prerequisites. COS 109 satisfies the QCR (née QR) requirement.

The labs are complementary to the lectures, 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 Python.

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. Stunning amounts of our private lives are observed and recorded by social networks, businesses and governments, mostly without our knowledge, let alone consent. Companies like Amazon, Apple, Facebook, Google and Microsoft are duking it out with each other on technical and legal fronts, and with governments everywhere. Shadowy groups and acronymic agencies routinely attack us and each other; their potential effect on things like elections and critical infrastructure is way beyond worrisome. The Internet of Things promises greater convenience at the price of much greater cyber perils. The careless, the clueless, the courts, the congress, the crazies, and the criminal (not disjoint groups, in case you hadn't noticed) continue to do bad things with technology. What could possibly go wrong? Come and find out.


Schedule (subject to change)

	Su Mo Tu We Th Fr Sa
Sep	             1  2  3
	 4  5  6  7  8  9 10	first class
	11 12 13 14 15 16 17	pset 1 due Wed 14, lab 1 due Sun 18
	18 19 20 21 22 23 24	pset 2, lab 2 due Wed 21, Sun 25
	25 26 27 28 29 30	pset 3, lab 3 (and so on)
Oct	                   1
	 2  3  4  5  6  7  8	pset 4, lab 4
	 9 10 11 12 13 14 15	open-book takehome midterm exam (no pset, no lab)
	16 17 18 19 20 21 22    fall break
	23 24 25 26 27 28 29	pset 5, lab 5
	30 31
Nov	       1  2  3  4  5	pset 6, lab 6
	 6  7  8  9 10 11 12	pset 7, lab 7
	13 14 15 16 17 18 19	pset 8, lab 8 (no more psets or labs after this)
	20 21 22 23 24 25 26    Thanksgiving
	27 28 29 30
Dec	             1  2  3
	 4  5  6  7  8  9 10	last class
	11 12 13 14 15 16 17	Dean's date; open-book takehome final exam Dec 17-21
	18 19 20 21 22 23 24
	25 26 27 28 29 30 31



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

Sep 7:    Overview and introduction
Readings: (1) Introduction and Chapter 1 of Understanding the Digital World: What is a computer? (2) A famous 1945 Atlantic Monthly article by Vannevar Bush,
As we may think, is often cited as predicting the Internet and the web. How does Bush's "Memex" relate to Google and your computer? What did Bush get right 75 years ago, and what did he totally miss?

Sep 12, 14:    What's in a computer?
Readings: (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 clear description of how computers are organized, though in archaic terminology. There's no need to read 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 nearly so detailed as von Neumann's.
Problem set 1, due Sep 14
Lab 1: HTML and web page design, due Sep 18

Sep 19, 21:    Representation of information
Readings: (1) Chapter 2 of Understanding the Digital World: Bits, bytes, representation of information.
Problem set 2, due Sep 21
Lab 2: Advanced HTML, due Sep 25

Sep 26, 28:    Inside the processor
Readings: (1) Chapter 3 of Understanding the Digital World: Inside the processor. (2) The original article on Moore's Law.
Problem set 3, due Sep 28
Lab 3: Graphics, due Oct 2

Oct 3, 5: Software and algorithms   
Readings: Chapter 4 of Understanding the Digital World: Algorithms
Problem set 4, due Oct 5
Lab 4: Spreadsheets, due Oct 9

Oct 10, 12: Programming and programming languages   
Readings: (1) Chapter 5 of Understanding the Digital World: Programs and programming languages.
(2) There are endless Python tutorials. Do a bit of searching and exploration.
Take-home midterm exam this week. There will (probably) be a Q/A session (probably) on Oct 9 (probably) at 4pm.   
No lab or problem set this week.

[Oct 17-21: fall break]

Oct 24, 26: Software systems   
Readings: Chapter 6 of Understanding the Digital World: Software systems.
Problem set 5, due Oct 26
Lab 5: Python, due Oct 30

Oct 31, Nov 2:    Intellectual property
Readings: (1) Sections 5.4 through 5.6 of Understanding the Digital World. (2) The first dozen or so pages of Google v. Oracle, the final [we hope] resolution of a decade-long case about software copyrights. (3) Chapter 7 of Understanding the Digital World; focus on the Python sections.
Problem set 6, due Nov 2
Lab 6: Python and NLP, due Nov 6

Nov 7, 9:    Communications: networks and the Internet
Readings: (1) Chapters 8 and 9 of Understanding the Digital World: Networking; The Internet. (2) Skim some of the Internet history papers. (3) Ed Felten's explanation of net neutrality.
Problem set 7, due Nov 9
Lab 7: AI and ML, due Nov 13

Nov 14, 16:    World Wide Web
Readings: (1) Chapter 10 of Understanding the Digital World: The world wide web. (2) The original technical paper describing Google. Skip the hard bits, but get the insights. Note the comments about advertising in Appendix A.
Problem set 8, due Nov 16
Lab 8: Privacy, due Nov 20

Nov 21:    Artificial intelligence, machine learning
Readings: (1) Chapter 11 of Understanding the Digital World: Data and Information; (2) Chapter 12 of Understanding the Digital World: Artificial Intelligence and Machine Learning.

Nov 28, 30:    Cryptography; compression and error detection
Readings: (1) Chapter 13 of Understanding the Digital World, Privacy and security. (2) New York Times Privacy Project

Dec 5, 7:    Catch-up; blockchains and cryptocurrencies; wireless; wrapup

[Reading period: Dec 9-16]

Q/A session some enchanted evening (somewhere)

Dec 17-22:    Take-home final exam during Dec 17-22 (approx)


Administrative Information

Professor: Brian Kernighan, 311 CS Building,

Office hours: after class, or by appointment; just send mail

Lectures: Monday and Wednesday, 1:30-2:50, Aaron Burr 219

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

No laptops, phones or tablets are permitted in lectures except for taking notes and other class purposes. Regrettably, computers and phones appear to be primarily used for mail, chat, YouTube, Twitter, Google, solitaire, poker, eBay, Facebook, Instagram, WhatsApp, TikTok, Snapchat, and similarly compelling diversions, all of which distract you, your neighbors, and me. (Additions to this list are welcome; I can't keep up.) This paper by Clay Shirky makes the case for banning distractors.

Textbook and Readings:

The primary text for the course is Understanding the Digital World, second edition ("UDW"). The first edition is still floating around. It doesn't have the new sections on Python nor the new chapter on AI and ML, but otherwise it's fine; use it if you like.

A heads-up on the textbook: Labyrinth's online catalog shows only the hardback, with a ridiculously high price. The paperback is identical and about 25% of the price. The site reveals the student prices, which are reasonable for new and used copies.

If you are particularly interested in privacy and security, Bruce Schneier's Data and Goliath is highly recommended.

Notes and readings will be posted online. The weekly readings beyond the text are for background, context, general education, and/or entertainment; you are not expected to know the detailed content, but you should understand the basic ideas. Anything in UDW is fair game, however.

Problem sets:

Eight 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 sets are due by midnight Wednesday, one week after they are assigned.


Eight labs, together worth about 20 percent of the course grade, will give hands-on practice in important aspects of computing. The labs are designed to be easily completed within 2-3 hours, if you have read through the instructions beforehand, which should take at most an hour. You can do the labs wherever you want, but if you need assistance, there are undergrad lab TAs who also support COS 126, 217 and 226. Further information about the lab TAs and clusters will be posted.

Labs are due by midnight Sunday of the week they are assigned.

Lateness policy:

In fairness to everyone, only reduced credit can be given for late submissions unless there are extraordinary circumstances, and in no case after solutions have been posted or discussed in class. For both labs and problem sets, heavy workloads in other classes don't count as "extraordinary," no matter how unexpected or important or time-consuming. I am also unsympathetic to the appeal that "this is my fifth class," since the same could be said of any one of your other classes.

If you do submit your work late, we will give you credit for it on this scale:

Regardless, you must turn in all problem sets and labs to pass the course.


If you find yourself in a tough situation, please let me know; help of various kinds is always available.


Collaboration policy:

You are encouraged to collaborate on problem sets, but you must turn in separate solutions; the names of all 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, for which the penalties are draconian.

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

As it is for problem sets, so it is for labs: collaboration to understand the material is encouraged, but the work you turn in has to be your own.

Exams and grades:

An open-book takehome 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 the end of the fifth week of classes. It will be worth 20 percent of the course grade.

An open-book takehome final examination will be given during the exam period. It will cover all material presented and discussed in class throughout the semester and any relevant reading. It will be worth about 35 percent of the course grade.

Sorry: no collaboration on exams.

There will be a question and answer session before each exam. Q/A sessions 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.

If you do poorly on the midterm but much better on the final exam, I will weight the final more heavily than usual, so a poor midterm grade is not fatal at all. But you must do acceptably well on the final; students who cannot answer even half the questions should not be surprised to get a D, and an F is not impossible, especially if other work is also inadequate.

Don't forget that P/D/F has three possible outcomes, only one of which is good. Attending lectures, paying attention, participating, turning work in on time, coming to office hours, studying for exams, and attending Q/A sessions all help to avoid unpleasant results.