Fall 2005 Final Exam Solutions - Network Application Design | ECE 4564, Exams of Electrical and Electronics Engineering

Fall 2005 Final Exam Solutions Material Type: Exam; Class: Network Application Design; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Fall 2005;

Typology: Exams

Pre 2010

Uploaded on 12/06/2007

vthokiegrad
vthokiegrad 🇺🇸

17 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 4564 Fall 2005 Final Exam Solutions Page 1 of 9
Virginia Tech
ECE 4564: Network Application Design
Final Exam Fall 2005 Solutions
Questions 1-20 are multiple choice questions. Circle only the one best answer for each.
If the word “PAGE” is in all capitals in the footer of each page of your exam, then the order of multiple
choice questions is different from what is provided here. However, the questions and solutions are the
same for both versions of the exam.
1. Which of the following facilitates client-side caching in HTTP?
(a) The “If-Modified-Since” header field.
(b) The “Not-Modified” header field.
(c) The “Content-Length” header field.
(d) Cookies.
Answer: (a). This header field allows a client to retrieve an entity only if its cached copy is stale.
2. Under which of the following condition should an HTTP/1.1 server include a “Connection:
Close” header field in its response to a GET request?
(a) If the client specifies HTTP/1.0 as its version.
(b) If the client specifies a “Connection: Keep-Alive” header field.
(c) If the client specifies a “Connection: Close” header field.
(d) If the client omits a “Connection” header field.
Answer: (c). The default behavior for HTTP/1.1 is to use persistent connections, i.e., to keep the
connection open. Thus, of the conditions given in (a) through (d), the server should specify
“Connection: Close” and close the connection only if the client has requested this behavior.
3. When will a host send an IGMP group report message?
(a) When an application leaves a group.
(b) In response to an IGMP query message from a router for a group to which an application
on the host is joined.
(c) When an application requests to join a new group.
(d) When an application requests to join a new group or in response to an IGMP query
message from a router for a group to which an application on the host is joined.
Answer: (d). A host sends an IGMP group report message when an application requests a join for a
socket and the host is not currently already in the multicast group. The host also sends an IGMP
group report message in response to an IGMP query message from a router if the host still has at least
one socket joined to the multicast group.
4. Suppose an ICMP “port unreachable” error message is sent by a server host to a client host.
How does system software at the client host know which socket in the client host is
associated with the error?
(a) The port number of the associated socket is identified in the IP header carrying the
ICMP message.
(b) The port number of the associated socket is identified in the ICMP header.
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Fall 2005 Final Exam Solutions - Network Application Design | ECE 4564 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Virginia Tech ECE 4564: Network Application Design Final Exam „ Fall 2005 „ Solutions

Questions 1-20 are multiple choice questions. Circle only the one best answer for each.

If the word “PAGE” is in all capitals in the footer of each page of your exam, then the order of multiple choice questions is different from what is provided here. However, the questions and solutions are the same for both versions of the exam.

  1. Which of the following facilitates client-side caching in HTTP?

(a) The “If-Modified-Since” header field. (b) The “Not-Modified” header field. (c) The “Content-Length” header field. (d) Cookies. Answer: (a). This header field allows a client to retrieve an entity only if its cached copy is stale.

  1. Under which of the following condition should an HTTP/1.1 server include a “Connection: Close” header field in its response to a GET request? (a) If the client specifies HTTP/1.0 as its version. (b) If the client specifies a “Connection: Keep-Alive” header field. (c) If the client specifies a “Connection: Close” header field. (d) If the client omits a “Connection” header field. Answer: (c). The default behavior for HTTP/1.1 is to use persistent connections, i.e., to keep the connection open. Thus, of the conditions given in (a) through (d), the server should specify “Connection: Close” and close the connection only if the client has requested this behavior.
  2. When will a host send an IGMP group report message?

(a) When an application leaves a group. (b) In response to an IGMP query message from a router for a group to which an application on the host is joined. (c) When an application requests to join a new group. (d) When an application requests to join a new group or in response to an IGMP query message from a router for a group to which an application on the host is joined. Answer: (d). A host sends an IGMP group report message when an application requests a join for a socket and the host is not currently already in the multicast group. The host also sends an IGMP group report message in response to an IGMP query message from a router if the host still has at least one socket joined to the multicast group.

  1. Suppose an ICMP “port unreachable” error message is sent by a server host to a client host. How does system software at the client host know which socket in the client host is associated with the error? (a) The port number of the associated socket is identified in the IP header carrying the ICMP message. (b) The port number of the associated socket is identified in the ICMP header.

(c) Part of the IP datagram causing the error is carried in the ICMP message. The port number of the associated socket is in the IP header of the original IP datagram. (d) Part of the IP datagram causing the error is carried in the ICMP message. The port number of the associated socket is in the TCP or UDP header of the original IP datagram. Answer: (d). The IP and TCP or UDP header of the original datagram that triggered the ICMP error message is sent back in the ICMP message. The port field in the TCP or UDP header allows the system software to identify the socket which caused the error. An error code can be returned and/or an exception can be thrown.

  1. What is the role of the AH within IPsec?

(a) Confidentiality. (b) Authentication. (c) Confidentiality and authentication. (d) None of the above. Answer: (b). AH, or Authentication Header, provides only authentication.

  1. A stateless firewall cannot implement which of the following filtering rules?

(a) Deny access to the secure network from a host with a specific IP address. (b) Deny TCP connection requests from the public network to the secure network. (c) Allow TCP traffic only for a connection established from a host in the secure network. (d) Allow UDP traffic only if addressed to a specific host in the secure network. Answer: (c). A stateless firewall cannot implement rule (c) since it requires that the firewall keep state information about the host which initiated the TCP connection. The other filtering rules rely only on information within the packet being processed, thus requiring no state information.

  1. Why does a nonce used as part of an authentication protocol need to be unique (or at least occur very infrequently)? (a) To eliminate the need for a public key. (b) To reduce the probability that an attacker can guess the key used by capturing traffic from multiple authentication transactions. (c) To protect against a man-in-the-middle attack. (d) To protect against a replay attack. Answer: (d). If the same nonce was used for multiple authentication transactions, a captured encrypted nonce could be sent back by an attacker and accepted as correct. This is a replay attack.
  2. Why is asymmetric key encryption widely used for web applications?

(a) Key distribution to clients is more scaleable since public keys can be distributed to a large number of clients by a relatively small number of trusted certificate authorities. (b) Asymmetric key encryption offers stronger encryption than symmetric key encryption. (c) Asymmetric key encryption can be used for both authentication and confidentiality. (d) Asymmetric key encryption can be used for authentication, confidentiality, and integrity. Answer: (a). Clients need to trust a certificate authority, not maintain shared (symmetric) keys with every possible server that they may want to access.

  1. The IP address or host name used to invoke a web service is associated with which element specified in a WSDL file for the web service? (a) A message. (b) A port. (c) A port type. (d) A name space. Answer: (b). The port element in the WSDL file is used to specify the URL to which the SOAP messages should be sent. This URL contains a host name or IP address of the server host providing the web services.
  2. What does it mean to “marshal arguments” in an RPC system?

(a) To identify input and output parameters of a remote procedure call. (b) To take parameter values and create a message passed to or from a remote procedure. (c) To convert arguments to a canonical intermediate format. (d) To convert a complex data type to a stream of data. Answer: (b). Marshalling of arguments is the process of serializing arguments, putting them in the right representation, and generating a message to be sent to the remote procedure. Marshaling needs to know the input and output parameters and their type, but it does not identify this information itself. And while marshalling may convert data to a canonical intermediate format (depending on the data representation used) and may convert complex data types to a stream of data, these are not always done by marshalling and are not a comprehensive description of the task of marshalling.

  1. The “port mapper” with ONR RPC allows…

(a) clients do not have to know the port number of the remote program before executing. (b) remote programs to not be executed until needed by a client. (c) remote programs to share a single port on the server host. (d) multiple versions of a remote program to run on a server without using version numbers. Answer: (a). Remote programs register with the port mapper. Clients query the port mapper for the port number of the remote procedure. Thus, clients do not need to know in advance the specific port number used by the remote procedure to which they are trying to connect.

  1. Which of the following is true in comparing web services (as discussed in lecture) to ONC RPC? (a) Web services use symmetric data representation, while ONC RPC uses asymmetric data representation. (b) Web services use asymmetric data representation, while ONC RPC uses symmetric data representation. (c) The development process for web services server and client applications is more tightly coupled than for ONC RPC server and client applications. (d) The development process for web services server and client applications is more loosely coupled than for ONC RPC server and client applications. Answer (d). The well-defined interfaces in the WSDL file allow greater decoupling of the development of a client and the development of the web service.
  1. What is the purpose of XDR’s “opaque” encoding?

(a) To pass data without encoding. (b) To pass data using XDR’s canonical intermediate format. (c) To pass a complex data structure with XDR. (d) To pass type information, but not the data itself. Answer (a). To put data as-is, i.e., without encoding, into the XDR stream.

  1. NDR and SOAP with XML both use explicit tags. How do they differ in this respect?

(a) Tags with NDR indicate only the type of the data, but not the representation scheme. Tags with SOAP with XML indicate both an encoding style and the type of data. (b) Tags with NDR indicate the representation scheme and the type of the data. Tags with SOAP with XML indicate only the type of data, but not the encoding style. (c) Tags with NDR indicate the representation scheme and the type of the data. Tags with SOAP with XML indicate only an encoding style, but not the type of data. (d) Tags with NDR indicate only the representation scheme, but not the type of the data. Tags with SOAP with XML indicate both an encoding style and the type of data. Answer (d). This is true for both NDR and SOAP with XML.

  1. NDR uses a “receiver-makes-right” approach to data representation. Why is it called this?

(a) The receiver always translates from a canonical intermediate format for the data to the receiver’s native representation of the data. (b) The receiver always translates from the sender’s native representation of the data to the receiver’s native representation of the data. (c) The receiver always puts the most significant byte of the data in the high-order (rightmost) byte. (d) The receiver always puts the most significant byte of the data in the low-order (rightmost) byte. Answer (b). “Receiver-makes-right” is a form of asymmetric data representation. The receiver translates from the sender’s native format.

  1. An HTTP server needs to generate the following two strings associated with a file to be sent in an entity body as a response to a GET request.
    • timeField: The “Last-Modified” entity header field as a String
    • lengthField: The “Content-Length” entity header field as a String The name of the file is already available in a String with name fileName. Write a “code snippet” in C# using .NET that, given String fileName, generates String timeField and String lengthField as should be included in a correct HTTP response. You do not have to initialize String fileName. You do not have to output the two Strings or do any other processing beyond what is stated here. The following code gets a FileInfo object which allows us to determine the last modification time and the file length. Note that the modification time is based on Coordinated Universal Time (UTC) and formatted according to the IETF standard. Note that the strings are the header fields, not just the specified value, so they should include “Last-Modified” and “Content-Length.”
  1. This problem considers IP multicast. Assume that Socket mSocket has already been created as a UDP socket and has been bound to port 7000 by the code below. Socket mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint localEP = new IPEndPoint(IPAddress.Any, 7000); mSocket.Bind(localEP);

a) Write a code snippet that allows mSocket to receive datagrams sent by other hosts to IP multicast group 239.255.10.10 and port 7000. For this part, the code should not actually attempt to receive any datagrams. The following code joins the multicast group 239.255.10.10. Note that we do not need to do anything additional to receive datagrams sent to port 7000 since the initialization code above bound port 7000 to the socket.

// Create IPAddress object for multicast group address. IPAddress mcastAddress = IPAddress.Parse("239.255.10.10");

// Create MulticastOption object with this group and any interface. MulticastOption mcastOption = new MulticastOption(mcastAddress, IPAddress.Any);

// Join the group. mSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, mcastOption);

b) Write a code snippet that receives a multicast datagram on Socket mSocket, but only from the host with IP address 10.10.1.50 and source port 5555. If a datagram is received with some other source host and port, then the code should attempt to receive another datagram. The code should continue receiving until a datagram is received from the host and port of interest. When a datagram is received from the host and port of interest, then the datagram should be in a buffer of type byte[]. The following code performs the desired function. At the end, the buffer will contain a datagram from the host and port of interest. Note that there is not a requirement that the code considers exceptions.

// Create EndPoint object for desired sender’s address. IPAddress ipDesired = IPAddress.Parse("10.10.1.50"); IPEndPoint ipepDesired = new IPEndPoint(ipDesired, 5555); EndPoint epDesired = (EndPoint)ipepDesired;

// Create EndPoint object for sender’s address. IPEndPoint ipepSender = new IPEndPoint(IPAddress.Any, 0); EndPoint epSender = (EndPoint)ipepSender;

// Buffer for datagram. byte[] buffer = new byte[1024];

// Receive an incoming datagram until the EndPoint values match. do { // Receive incoming datagram. int received = mSocket.ReceiveFrom(buffer, ref epSender); while (!epDesired.Equals(epSender));

  1. This problem considers data representation.

This version of the question appears on exams where “Page” is in mixed case in the footer of each page of the exam.

a) Consider the C# struct shown below and the associated code for initialization. struct snow { public int x; public int[] y; }

snow s; s.y = new int[2]; s.y[0] = 6; s.y[1] = 7; s.x = 5; Assume that XDR is used to represent instance s of structure snow. For each four-byte field below, show values that would be used in the XDR representation of s as initialized in the code above. Give your answer in decimal within each four-byte field. You may not need to use all eight of the four-byte fields that are shown. Start with the left-most four-byte field. The answer is shown below. Note that the only metadata is the length of array y[ ].

x Length of y y[0] y[1] Not Used

x Length of y y[0] y[1] Not Used

b) Consider the snippet from a WSDL file shown below. <xsd:complexType name="Piece"> <xsd:all> <xsd:element name="active" type="xsd:boolean"/> <xsd:element name="index" type="xsd:int"/> <xsd:element name="speed" type="xsd:float"/> <xsd:element name="angle" type="xsd:float"/> </xsd:all> </xsd:complexType> Specify a C# struct that corresponds to the WSDL definition above. Each element defined in the WSDL file corresponds to an element of the structure.

struct Piece { public Boolean active; public int index; public float speed; public float angle; }