INFO I320 Midterm Review

(Module 10: Midterm review and exam)

Version 6.21

Fall, 2011

Exam date: Friday, October 28, 2:00–3:15 p.m. (or as arranged for online section).

Format

The exam will be given on paper and answered using a pencil or pen. There will be a mixture of question types, possibly including multiple choice, true/false, short answer, essay, and coding.

The exam will be given in two parts: Part I, Concepts and Terms, Closed Book and Notes; Part II, Coding, Open Book and Notes. Students may take either part first, but must complete that part before beginning the other part.

Topics

The exam will cover modules 2–7:

Modules 2–3: Introduction and Sockets

Terms: protocol, IP, packet, TCP, UDP, connection, host, node, IP address or IP number, DNS, port, process, well-known ports, client/server model, server process, client process, socket, datagram, datagram socket, stream socket, stream, server socket, telnet, netcat (nc), URI, URL, RFC.

Know the names and descriptions of the four layers of the Internet architecture. Be able to say in which layers the following protocols operate: IP, TCP, UDP, SMTP, HTTP, telnet.

Distinction between connection-oriented and connectionless networking.

Distinction between TCP and UDP. Why use one or the other?

Discuss the reliability or unreliability of TCP and UDP.

Distinction between blocking (synchronous) and non-blocking (asynchronous) communication.

Python: how to create a socket and bind to an address and port, listen for and accept connections.

Python: how to connect as client to a given server and port, using a stream socket, and to send and/or receive a message through the socket (see sample questions).

??? Three paradigms of computing: client/server, peer-to-peer, and message-passing. Design of distributed systems: advantages and disadvantages of client/server versus peer to peer, design of a simple message-passing protocol.

Kinds of protocol: text-based, binary, request-response.

Module 4: Network Data and Errors

Terms: string, Unicode, bytes object type in Python, network byte order, pickle, JSON, exceptions.

How to handle exceptions (try / catch statement in Python).

Module 5 TLS/SSL

Terms: TLS/SSL, public key encryption, certificate.

Explain how TLS protects against spoofing (impersonating a host) and sniffing (listening to network data).

Module 6 Server Architecture

Terms: process, thread, fork, parent/child, deadlock, race condition, thread-safe, lock, zombie process.

The role of the Python class Thread (from the threading module).

Writing Python statements to create and run a thread which performs a simple task (see sample questions).

Distinguish between iterative and concurrent servers.

Why a server might create and run threads.

(Concurrent servers based on asynchronous I/O will not be covered.)

Module 7 Name Resolution and DNS

Know what DNS is, why we have it, and the general concept of how it works.

Be able to explain forward and reverse DNS lookup.

Sample Questions

Closed Book and Notes

  1. Protocol for a Driver License System

    Design a message-passing protocol for the Bureau of Motor Vehicles driver license system. The application will use a central server which maintains license data. Clients will be located at the Bureau's 200 branch offices throughout the state. Clients and server will communicate via connection-oriented, stream sockets over TCP.

    The protocol should enable branches to issue new driver licenses and to renew old driver licenses. For a new license, the branch office will collect the following information from the driver and send it to the central system: name (first, last), address (street, city), date of birth. The central system will then create a new license number, and the branch office will issue the license with that number to the driver. For a renewal, the branch office will normally send only the license number to the server, but may also send any of the data required for a new license, to make corrections or updates. The expiration date for a new or renewed license is four years from the date issued or renewed. The server will compute the expiration date.

    In your answer, specify the syntax and semantics of each message clearly and precisely. Formally specify the messages; don't just give examples. But do show at least one example scenario (i.e., a "dialog" between server and client).

    Note that you are not to write a program, just design and specify the protocol.

  2. Design a message-passing protocol for a client/server dictionary service. Users of the service can ask the online dictionary for the definition of a word, and can add new words and definitions to the dictionary.
  3. Consider the color service as a peer to peer system. How would it be different from the client/server system? What would be the advantages and disadvantages?
  4. Concurrent Servers.
    1. What are processes and threads? What is the difference between them?
    2. Write the Python statement(s) to fork a process. After forking, how does a process know whether it is parent or child?
    3. Give an example of a program which needs to spawn child processes or threads. Explain why this is necessary.
    4. What is a race condition? How can it be avoided in a Python program?
  5. SSL/TLS
    1. Describe some kinds of attacks that SSL/TLS can protect against, and some kinds that it cannot.
    2. What is public key encryption?
    3. What is the role of a certificate authority?
  6. Distinguish between Python string and bytes objects.
  7. Why should network data be sent in network byte order?
  8. Explain the role of the pickle module.

Open Book and Notes

  1. Write the Python statements needed for a client to create a stream socket, connect it to the host info.recipes.org on port 5050, send the message "REQUEST plum pudding", receive a one-line response, and disconnect.
  2. Same problem, but using a datagram socket (so, no connection or disconnection).
  3. Write the Python statements for a server to open a stream socket, listen on port 8089, accept a connection, send the message "hello" to the connected client, close the connection, and finally close the socket.
  4. Write Python statements to spawn two threads. One thread should print out a "countdown: 10, 9, 8, 7, ..., 0", one number per line, on the terminal. At the same time, the other thread should print the letters A through K, one letter per line, in ascending order.
  5. Write Python statements which fork a process. The code should determine whether, after the fork, it is the parent or child process. If it is the parent, it should print "Children must respect their parents." If it is the child, it should print "Parents must be kind to their children."

  1. Revisions:
    • Version 6.2, 2011 Oct 20. Converted to markdown. Moved name resolution from final to midterm. Added network data and errors to midterm.
    • Version 6.1, 2009 Oct 7. Added three paradigms of distributed computing and two new sample questions.
    • Version 6, 2009 Oct. 7. Shifted content between midterm and final exams: added forking and threading; removed advanced network operations and XML-RPC.
    • Version 5, 2008 Oct. 4. Specified exam dates and where to sign up for testing.
    • Version 4, 2008 Oct 2. (Rough draft) Revised for new course organization with the Goerzen textbook.
    • Version 3, 2007 Oct 6.
    • Version 2, 2005 Oct 5.