Docsity

Final Exam - Network Programming | CS 228, Exams of Computer Science

Toggle sidebar
bg1
CS 228 – Final Exam of the Rhino
1. (four points) Which TCP ports can one connect to on
turing.nmu.edu? Show me a program you wrote that
answers this.
2. Is your name on the test (choose all that apply)?
a) Yes, I want to pass the class.
b) No, I don't want to pass the class.
c) Yes, but I don't want to pass the class.
d) No, but I really really want to pass the class.
e) Your kid helped you write both 'c and 'd'.
3. (Yes/No) Suppose I call exit(0). Does that automatically close for that process any file
descriptors it might have open?
4. (Yes/No) Does standard Ethernet require synchronized clocks on the computers using
Ethernet? (i.e. clocks that all know the current time of day to a reasonable degree of
accuracy)?
5. How many computers can have a class 'C' IP number? I want a number like
123,456,789.
6. Suppose a TCP sender sends packets of data. It sends a packet with data bytes 0-999,
another with packet 1000-1999, and a third with 2000-2999. The first packet's
corresponding ack is lost. All other acks are received. Must the bytes 0-999 be resent?
a) Yes.
b) No.
c) Maybe
7. Suppose a Rhino sends a 1000 bytes of TCP data, all in one Ethernet packet. Counting
all headers except the Ethernet preamble, how long is this Ethernet packet?
8. Hawaiian rhinos still use Aloha. They need to maximize bandwidth; that's all they care
about. They are arguing over which aloha is most efficient. So ... which version of
Aloha is most efficient.
9. (True/False) In the ping-pong protocol, there is at most two outstanding data packets on
the wire at one time, not counting acks.
10. Which of these system calls can place bytes on the wire? (choose all the apply)
pf3
pf4

Partial preview of the text

Download Final Exam - Network Programming | CS 228 and more Exams Computer Science in PDF only on Docsity!

CS 228 – Final Exam of the Rhino

1. (four points) Which TCP ports can one connect to on

turing.nmu.edu? Show me a program you wrote that

answers this.

  1. Is your name on the test (choose all that apply)? a) Yes, I want to pass the class. b) No, I don't want to pass the class. c) Yes, but I don't want to pass the class. d) No, but I really really want to pass the class. e) Your kid helped you write both 'c and 'd'.
  2. (Yes/No) Suppose I call exit(0). Does that automatically close for that process any file descriptors it might have open?
  3. (Yes/No) Does standard Ethernet require synchronized clocks on the computers using Ethernet? (i.e. clocks that all know the current time of day to a reasonable degree of accuracy)?
  4. How many computers can have a class 'C' IP number? I want a number like 123,456,789.
  5. Suppose a TCP sender sends packets of data. It sends a packet with data bytes 0-999, another with packet 1000-1999, and a third with 2000-2999. The first packet's corresponding ack is lost. All other acks are received. Must the bytes 0-999 be resent? a) Yes. b) No. c) Maybe
  6. Suppose a Rhino sends a 1000 bytes of TCP data, all in one Ethernet packet. Counting all headers except the Ethernet preamble, how long is this Ethernet packet?
  7. Hawaiian rhinos still use Aloha. They need to maximize bandwidth; that's all they care about. They are arguing over which aloha is most efficient. So ... which version of Aloha is most efficient.
  8. (True/False) In the ping-pong protocol, there is at most two outstanding data packets on the wire at one time, not counting acks.
  9. Which of these system calls can place bytes on the wire? (choose all the apply)

a. gethostbyname b. gethostname c. accept d. bind

  1. (Yes/No) Can any user without special superuser privileges connect using the connect() system call to ports under 1024?
  2. Suppose that fork returns the number 1256 to the parent. What does the number 1256 represent?
  3. Suppose Firefox sends an HTTP/1.1 request. It receives a reply. How does Firefox know where the meta data ends and the actual data begins?
  4. (Yes/No) Randy Rhino runs www.rhinoes-rule.com. He wants to block all connections from www.monkeys-rule.com to his www.rhinoes-rule.com but allow everything else, including all other internet traffic.. His router stops all packets with the SYN and ACK bit set heading to www.rhinoes-rule.com from www.monkeys-rule.com, but allows everything else. Does this work?
  5. (Yes/No) I want to access an IP number run by panda bears in China from my network in Africa. I don't know the MAC address for this Chinese host. Should I use ARP?
  6. I have a DHCP lease. Suddenly the DHCP server needs the IP number returned. How can the DHCP server suddenly cancel my lease on the IP number?
  7. Suppose two Rhinos are fighting over an NMU laptop. What is the most likely outcome? a) The computer ends up looking like spaghetti b) The computer ends up looking like gazelle guts. c) I think your kid helped write this question.
  8. In practice as things are implemented at Charter cable company and at NMU, how often does your laptop access access the DNS main root servers? a) Never b) Generally once per reboot c) Generally a few times per reboot (2-10 times) d) Generally many times per boot (more than 10 times).
  9. As a sender you keep sending packets, but a high percentage of them are not acknowledged on the first sending. What should you do? (pick all that apply)

int a = 0; int pid = fork(); if (pid == 0) { a = 1; } cout << a << endl; }

  1. My server should handle multiple connections, starting the next one after the first is finished. Which is most correct? while (1) { ret = fork() if (ret == 0) { client = accept( ...) doStuff(client) exit(0) } // end if } / end while while(1) { client = accept(...) doStuff(client) close(client) } ret = fork() if (ret == 0) { while (1) { client = accept(...) doStuff(client); close(client) } // end while } // end if P.S. My kid says“For comedy and Kamikaze go to http://www.albinoblacksheep.com/flash/demented.php” P.P.S. My kid now says “Warning. This may be too silly for adult and make you cough your guts out”.