CS 228 The Election Midterm

  1. (TCP/UDP) Which is slower TCP or UDP?
  2. Suppose I know someone's IP address.  I want to know their MAC address.  What should I do?


  3. (Yes/No) Do IP packets ever leave the sending host with the Fragment bit set?
  4. Suppose the minimum packet length for Ethernet was 42 bytes, with included a 20 byte header.  An IP packet has a 20 byte header,  If I want to send three bytes of data (the word "yes") how many total bytes would the ethernet need to send? ___________________
  5. Why does the traffic recieved go down as more stations want to send?
    Workstations Sending Traffic Received
    1 10.3 kb/sec
    10 97 kb/sec
    100 301.6 kb/sec
    1000 27 kb/sec
    10000 0.034 kb/sec
  6. (2 points) Suppose I change Ethernet.  Instead of waiting a time that depends on the number of previous collisions, I instead wait a random time between 1 .. 50 milliseconds.  I modify every workstation on the network to use my protocol.
    Will this send data? (Yes/No)
    Under what conditions will this work poorly? ___________________________________
    _____________________________________________________________________
  7. I just looked up www.aol.com and found the IP address 64.233.167.104.  What class IP address is that?
    1. A
    2. B
    3. C
    4. D

  8. Which of these looks like good server code?
    pid = fork()
    fd = accept ( ...)
    if (pid == 0)
         handle connect
         exit
    fd = accept( ..)
    pid = fork()
    if (pid == 0) 
        handle connection
        exit
    while(1) 
       pid = fork()
       fd = accept( ... )
       if (fd == 0)
          handle connection
          exit
    while(1)
       fd = accept( .. )
       pid = fork()
       if (pid > 0) 
         handle connection
         exit

  9. What does fork return?
    1. The process ID of the parent
    2. The process ID of the child
    3. A zero
    4. A minus one
  10. Who does the fork?
    1. The client
    2. The server
    3. Both
    4. Neither
  11.  Using the functions we have seen in class, how do you access the Ethernet part of a packet you just read?




  12.  What can poll() due that select() cannot due.


  13.  Put a "T" next to those programs that probably use TCP, and a "U" next to those programs that probably use UDP
    1. ___ HTTP (web pages)
    2. ___ Windows Media Player (streaming audio)
    3. ___ Kazaa (transfers MP3s)
    4. ___ Xboard (real time chess!!!)
  14. How many packets with the FIN bit can be sent per TCP connection?


  15. Suppose I receive a packet using TCP and the ack field is 1000 and the ack bit is 'true'.  Which byte is the other guy expecting to recieve next?

  16. Suppose every time I see an ARP query for someone, and I know that answer for that query, I answer for them.  If I don't know the answer I am silent.  What would my wife notice if she were to use such a network?



  17. I change the DHCP protocol only for myself.  I don't ask for a lease renewal at 50% and 87.5% of the lease period.  Instead I ask for the lease renewal only at 75% of the lease period.  What likley real world effect will this have?



  18. Which of the following system calls place bytes upon the wire?  (circle any that apply)
    1. socket
    2. connect
    3. write
    4. read
    5. gethostbyname
    6. close
    7. bind
    8. accept
  19. Look at the code below. Add to it the code need to print the buffer and the error checking code needed to print an error message and exit on error. It's not known if the sender has null terminated the data.
      int ret = read(sock, buf, 100);







  20. I am attempting to open a socket and connect to a server.  The server does not have that port open.  Which system call will fail?


  21. I am attempting to open a soket and connect to a client. The client does not have that port open.  What system call will fail?