CS422: Fall2004 Midterm
| Question |
Max. |
Current |
| Part I. True and False |
10 pts. |
|
| 1-5 |
15pts |
|
| 6-10 |
15pts |
|
| 11-15. |
20pts. |
|
| 16. |
10 pts. |
|
| 17. |
10 pts |
|
| 18. |
10 pts |
|
| 19. |
10 pts |
Part I. Answer True or False (T/F) (1 point each).
false The application that gave birth to the Internet was e-mail.
true RS232 was used to connect dumb terminals.
true AM is more susceptible to noise than FM
true Signals are modulated in a sine wave to travel long
distances.
true According to Shannon's theorem, if S/N = 1 then the throughput
is equal to the bandwidth.
false byte stuffing reduces the number of the bytes transmitted.
false ESC is translated to ESC-Y when it appears in the data
section in RS232.
true Assuming even parity, the byte 10010010 is an error.
false A protocol that uses CRC will detect all transmission errors.
false Two ethernet cards may have the same ethernet address.
Part II. Answer the following questions:
1. (3 pts) Explain why data is divided into packets in a network
before transmission.
Ans.
2. (3 pts) Explain the advantages and disadvantages of choosing small-size packets in a shared network vs. using large packets.
Ans.
3. (3 pts) Explain how an inverse multiplexor works.
An inverse multiplexer is used to send data using multiple channels. The data is interleaved one byte at a time in each channel.
4. (3 pts) Explain how byte stuffing works.
Byte Stuffing is used to send special characters like soh or eot in the data section. These special characters are substituted
with a special sequence soh->soh->escx and eot->escy esc->escz so the special characters do not appear as data when sent. The receiver
transforms this back.
5. (3 pts) Assume the following 4 bytes are sent: 10010011,
11011010, 00100101, 11101011. Give an
example of how the sequence can change due to error and still have the
same checksum.
Ans.
10010011, 11011010, 00100100, 11101010 has the same checksum
6. (3 pts) Assume four computers A, B, C, D connected to an ethernet
switch. a) Describe a case when the ethernet switch will improve the
total throughput of the network and b). Describe a case when an
ethernet switch does not improve the total throughput of a network.
8. (3 pts) What is the difference between a repeater and a bridge?
9. (3 pts) a) Enumerate the 7 layers of the ISO-7 layer reference
model. and b) Enumerate the 5 layers in the TCP/IP layering
Ans.
ISO-7
10. (3 pts) Explain why ATM is more suitable than the Internet to
transport real time traffic such as telephony and video conferencing.
Ans.
11. (4 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 ) );
Ans.
To be able to reuse the port immediately otherwise it will need to wait for about 5 minutes to reuse.
12. (4 pts) In the listen call, explain how the QueueLength affects the behavior of your server.
error = listen( masterSocket, QueueLength);
Ans.
QueueLength is the maximum number of connections waiting to be accepted. If this number is too low, the server will not be able to
accept a large number of simultaneous connections.
13. (4 pts) In CSMA/CD explain how collisions are resolved step by
step.
Ans.
14.(4 pts) In CSMA/CA explain how CA is done step by step.
Ans.
A broadcasts a small packet saying that A will transmit to B and A reserves the medium in A's range
B broadcasts a small packet sayingthat B is going to receive from A and reserves the medium in B's domain.
15.(4 pts) Explain how the network traffic affects voice over IP.
Ans.
The delay will increase with increase of traffic.
D0: Delay without traffic
U: Network Usage
D= D0/(1-U)
|
16. (10 pts.) Add the code below that prints only the TCP
packets and for each TCP packet is prints the source address,
destination address, source port, and
the destination port. All other packets are ignored. from ether.h: from ip.h: analyze.c: |
| 17. (10 pts) From lab4 write the procedure fileRequestedIsDirectory(const char *
fileRequested ) that detects if the file requested is a
directory and also write the procedure directoryListing(int sslave, const char *
dirName) that writes into sslave
the directory listing of dirName
in HTML <>bool fileRequestedIsDirectory( const char * fileRequested ) > // Return true if fileRequested is a directory struct stat s;
|
18. (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) {
// Other procedures serverthread(int ms){ while (1) { int ss = accept(...); if (ss < 0) continue; dispatchHTTP(ss); } } |
| 19. From lab4 write the function that implements
cgi-bin with shared modules. You will need to implement the function dispatchCGILoadableModules(
int
slaveSocket, char * document ). The function void dispatchCGILoadableModules
will
be called when the document requested has the pattern"cgi-bin/*.so" The
document passed as argument will be of the format
cgi-bin/<modname>.so[?a=b&c=d...]. The procedure will load
the module if it has not been loaded already and it will call the
httprun(int ssock, char * query_string) function. Write also any global
variables you need. // Global variables void dispatchCGILoadableModules( int slaveSocket, char * document ) } |