ComiCS

Consider the comic below.

cookie monster

Source: unknown

  1. (2 points.) In no more than three sentences, what is a cookie, in technical terms, in the context of HTTP?

  2. (2 points.) In no more than three sentences, how do cookies enable data collection?


Consider the comic below.

Little Bobby Tables

Source: xkcd.com/327

  1. (2 points.) In no more than three sentences, what is a SQL injection attack, in technical terms?

  2. (2 points.) In no more than three sentences, why should you use a library like CS50’s own to format SQL statements with placeholders (e.g., ?) rather than use, e.g., Python’s own f-strings (with curly braces) to format statements yourself?


Consider the comic below.

I will not throw paper airplanes in class

Source: FoxTrot

  1. (2 points.) In a file called foxtrot.py, implement precisely the same program in Python.

Consider the comic below.

sudo make me a sandwich

Source: xkcd.com/149

  1. (2 points.) Among the Linux commands we didn’t introduce this term is sudo. In no more than three sentences, exactly what does sudo do?

Consider the comic below.

setting up my programming environment

Source: dilbert.com/strip/2017-01-02

Not only has code.cs50.io enabled you to use VS Code in the cloud, without installing it on your own Mac or PC, it has also had clang, python, sqlite3, http-server, and flask pre-configured for you. While you’re welcome to continue using your codespace after term’s end, let’s also prepare you to write, at least, Python on your own Mac or PC!

  1. (1 point.) Complete each of the steps below. You might encounter some technical difficulty along the way, but that’s why this problem is at term’s end rather than start!

    1. Download VS Code from code.visualstudio.com and install it on your own Mac or PC, per these instructions. If you have a Chromebook, though, you may skip this problem or try these instructions instead.

    2. Download the latest version of Python from python.org/downloads and install it on your own Mac or PC.

    3. Launch VS Code on your own Mac or PC and create a new file called hello.py containing just the below:

      print("hello, world")
      

      Save the file and execute the below in VS Code’s terminal window. You might need to cd first to the directory with hello.py.

      python hello.py
      

      If the command is not found, try python3 instead of python, else you might also find search results like google.com/search?q=add+python+to+path of help. Alternatively, for this problem and this problem only, you are welcome to ask another human for help.

    4. As soon as “hello, world” prints as expected, take a screenshot (showing your code and your terminal window) and submit it as your answer to this problem.