CS422: Fall2005 Midterm


Name:___________________________________________

 

Question
Max.
Current
Part I. True and False
10 pts.
 
1-5
15pts
 
6-10
15pts
 
11-15
15pts.
 
16-19
15 pts.
 
20.
10 pts
 
21.
10 pts
 
22.
10 pts
















Part I. Answer True or False (T/F) (1 point each).

T__ RS232 uses +15 V to represent a 0.

F__ If A has a half duplex communication to B then A can send data to B but B will not be able to send data back to A.

T___According to Shannon's theorem, if there is no noise in a chanel then the throughput can be infinite.

F___Assuming odd parity, if a receiver receives a character 01110110 it will trigger an error.

F___Checksum is able to detect positional errors

T___The maximum throughput of a T1 line is 1.544Mbps

T___ The TTL field in an IP packet uses 8 bits

F___ 226.78.20.34 is a class B network

F___ The host hat originates an IP packet may fragment a packet if it is larger than the MTU of the network.

F___ 802.11b is able to send up to 54Mbps


Part II. Answer the following questions:

1. (3 pts) Explain what is quantization noise.

Digital encoding has a finite number of levels. Quantization noise is caused by rounding errors.


2. (3 pts) Explain why data is modulated in a carrier wave.

To reach long distances.



3. (3 pts) Explain why "byte stuffing" is used in RS232.

It is used to escape SOH, SOT characters in case they appear in the data section of the frame. It is confused with a start of header, end of transmission.




4. (3 pts) Explain the sequence of events that could lead an Ethernet packet to take a long time to be delivered.

- Successive collisions might cause an Ethernet packet to take a long time to be delivered.

- This might be caused by a high usage of the network.


5. (3 pts) Explain why 802.11 uses CA (Collision Avoidance) instead of Collision detection.

Because two machines sending at the same time might not be able to detect collisions if both are out of range of each other.




6. (3 pts)Explain the characteristics of ATM that make it better than Ethernet to send real time data like voice and video.

- ATM sets up a virual circuit in the switches in the path that reserves bandwidth before the transmission.

- The cells are small(53bytes). This reduces latency



7. (3 pts) Explain when the TTL field in an IP packet is decremented
- Everytime a packet is forwarded by router, the TTL is decremented.

- Also the TTL is decremented every second a packet is in the queue of a router.




8. (3 pts) What is the difference between a repeater and a bridge?

- repeater
    + analog
    + repeats noise and collisions

- bridge
    + digital
    + understands packets
    + only forwards packets if  destination is in the opposite segment.

<>9. (3 pts) Enumerate the components of the delay in a network.
- propagation delay
- switching delay
- queueing delay

10. (3 pts)  Enumerate the 5 layers in the TCP/IP layering

- Application
- Transport
- Internet
- Network interface
- Physical

11. (3 pts) What is it done in the Internet to ensure that real time traffic like Voice over IP have acceptable delays?

- Increase network bandwidth so that the utilization is low and queueing delays are small as well.

- Make real time traffic have a higher priority.

- Route real time traffic through a different faster path.

12. (3 pts) Explain what the following line is used for in your HTTP server

int optval = 1;
int err = setsockopt(masterSocket, SOL_SOCKET, SO_REUSEADDR, (char *) &optval, sizeof( int ) );

When a process exits, by default, the ports it has used cannot be reused for 5 minutes. The SO_REUSEADDR option
is used to overide the default and allow the port number to be reused immediately.


13. (3 pts) Describe the Layering principle

- A module at layer i will receive messages that were originated only from layer i.

- A module at layer i can only communicate with one layer above and below.

<>
14. (3 pts) Give an example when the layering principle is broken in TCP/IP on Ethernet
- NAT (network address translation)
    It modifies fields in both the IP header and TCP header.
- TCP layer needs to know the MTU of the network so that it skips the Internet interface to get information from
network interface.


15.(3 pts) Computer A will send an IP packet to B where B and A are in the are in the same Ethernet network. Describe the packets that are exchanged assuming that A does not know  B's MAC address.

<>
- A looks up B's hardware address and it does not find it then it will broadcast an ARP request through the network requesting B's hardware address.
- B sends a unicast ARP response to A telling its own hardware address.


16. (3 pts)  Computer A will send an IP packet to computer B in a 802.11b network. Describe the exchange of all the packets needed to achieve that. Assume that A already knows the hardware address of B.
- A sends an RTS(request to send) message to B. All machines reachable from A receives it.
- B replies with a CTS(clear to send). All machines reachable from B receives it.
- For the requested time no machine reachable from X and Y will use the shared medium.
- A sends ACK to B.


17. (3pts) Explain what is "Infrastructure Mode" and "Ad-Hoc" mode in 802.11.
- Infrastructure mode uses a base station for communication.
- In Ad-Hoc mode, computers can talk to each other directly without the base station.



18. (3pts) What does WEP stands for and what it is used for.
- Wired Equivalent Privacy
- It is a security feature in 802.11 where the data is encrypted/decrypted using a WEP key.


19. (6 pts)Write a diagram with the fields of an IP packet and the lengths of the fields

(refer to books)







Part III. Programming questions

20. (10 pts) From lab3 write the procedure void dumpURL(const char * url ) that will print in stdout the requested URL.

void
dumpURL(const char * url ) {
  




























}


21. (10 pts.) From lab4, assuming you have a procedure void dispatchHTTP( int slaveSocket) that processes the request and closes slaveSocket, write the loop server code for a) iterative server, b) concurrent server using fork, c) concurrent server creating a thread after each request, and d) pool of threads,  in  the procedures indicated. Each procedure receives as argument the master socket already initialized and ready tobe used inside accept.

void iterativeServer( int masterSocket) {





}
<>void forkServer( int masterSocket) {







}


void poolOfThreads( int masterSocket) {







}

void createThreadForEachRequest( int masterSocket ) {








}

// Other procedures









22. (10 pts) From lab4 write the function that implements cgi-bin that executes programs stored in the directory cgi-bin/. The "document" variable contains the name of the program or script as well as the variables in the form "prog?a=b&c=d..."

// Global variables




void dispatchCGIProgram( int slaveSocket, char * document )
{































}