



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Fall 2005 Midterm Material Type: Exam; Class: Network Application Design; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Fall 2005;
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




(a) A server provides responses to HTTP requests. (b) A server creates a socket, makes it passive using the LISTEN operation, and then accepts connections with the ACCEPT operation. (c) A server accepts a SYN request and responds with an ACK and a SYN request to complete the connection. (d) TCP is strictly a peer-to-peer protocol and, therefore, there is no feature or operation that distinguishes a client from a server. Answer: (c). Answer (a) is true from the perspective of HTTP, but not from the perspective of TCP. Answer (b) is true, but from the perspective of the sockets application program interface and not TCP. Answer (d) is not true.
(a) TCP provides a reliable datagram service, while UDP provides a best-effort datagram service. (b) TCP provides a reliable stream service, while UDP provides a best-effort datagram service. (c) TCP uses a header, so it is less efficient than UDP which is a “header-less” protocol. (d) TCP uses port numbers to identify process- or application-level end-points, while UDP does not use port numbers. Answer: (b). Only answer (b) is true.
(a) A socket created by a client and that is connected to the server. (b) A socket created by a server and that is connected to the client. (c) A socket created by a server and that is used to accept connections from a client. (d) A socket temporarily created by a server to receive UDP datagrams. Answer: (b). An ephemeral socket is created when the accept call returns and is connected to the client whose connection was accepted.
(a) By executing the Socket.Connect method at the client. (b) By executing the Socket.Connect method at the server. (c) By executing the Socket.Synchronize method at the client. (d) By executing the Socket.Synchronize method at the server. Answer: (a). Calling the Socket.Connect method at the client causes TCP at the client to generate a SYN request to the server. TCP at the server will also generate a SYN request to the client, but this might be done by TCP at the server before Socket.Accept is called, as is the case with pending connections. So, answer (a) is better than answer (b). There is no such method as Socket.Synchronize.
(a) SMTP messages must consist of 7-bit ASCII characters. (b) SMTP uses TCP. (c) SMTP is a mail access protocol. (d) SMTP is a client-server protocol. Answer: (c). All are true except answer (c). SMTP is not a mail access protocol. IMAP and POP3 are commonly used mail access protocols.
(a) No. It supports “cookies” that provide state information. (b) No. It uses TCP which is a stateful protocol. (c) Yes. No state is maintained by HTTP between different HTTP requests. (d) Yes. It uses UDP which is a stateless protocol. Answer: (c). HTTP is stateless, although other schemes may be used with HTTP to maintain state. For example, using cookies is a way to maintain state, but state is maintained outside of TCP. HTTP uses TCP, not UDP.
(a) When both the client and server use only HTTP/1.1. (b) When the client-server round-trip time is low. (c) When objects are being transferred from client to server using PUT or POST. (d) When small objects are being transferred.
causes the receiver buffer at the server and the send buffer at the client to fill, thus leading to deadlock. (This scenario was discussed in lecture.)
(a) To detect a client that is “hung” or otherwise unresponsive. (b) To help avoid deadlock due to an unresponsive client. (c) To wait for TCP to complete sending a stream of data from the client. (d) To reduce resources expended due to a denial-of-service attack. Answer: (c). Time-outs are not a way to deal with TCP’s Nagle algorithm, as suggested by answer (c). The other answers are all appropriate uses for time-outs at the server.
Answer: (c). There could be a conflict between the send and the receive operations as they are executed in different threads.
(a) Argument “state” is a Boolean that indicates whether or not subsequent calls are stateful. (b) Argument “state” is a Boolean that indicates if mutual exclusion is needed with other asynchronous calls. (c) Argument “state” provides information to the system about the requested receive or send operation. (d) Argument “state” provides information to the callback method. Answer: (d). The state object is passed into the callback method to provide application-specific information.
What is the purpose of the “for” loop in the code? (a) To copy active sockets from socketList to tempList since it will be overwritten by the Socket.Select method. (b) To copy only the active sockets from socketList to tempList so tempList contains no inactive sockets. (c) To format tempList as required by the Socket.Select method since socketList is not in proper form. (d) To ensure all sockets in socketList are cast as type Socket in tempList. Answer: (a). Socket.Select will overwrite tempList with just sockets needing service (for read or accept, as indicated in Question 20), so the code needs to preserve the full list of sockets for the next call to Socket.Select. This is done by copying the list of sockets in socketList to tempList before the call to Socket.Select. Note that socketList should not have any “inactive” sockets, so answer (b) does not make sense.
(a) A list of all sockets ready for service. (b) A list of all sockets ready to be read. (c) A list of all sockets ready to accept a connection. (d) A list of all sockets ready to be read or to accept a connection. Answer: (c). Socket.Select will leave in tempList just those sockets that are ready for service for a read or accept operation. Note that sockets that are ready to be written will not be in the list. So, answer (c) is the best answer.
PROTOCOL Method Request: PROTOCOL Action: Determine the protocol type (see below) and return to the client as an ASCII text message. Reply: ASCII text message of at most 128 characters that contains the protocol type.
treated as just data, as is done by the ECHO server examples. However, points were not counted off if this assumption were made and the implementation is correct with this assumption.