Professional Documents
Culture Documents
Name:
Rules: Short answers are appreciated. Each question scores 2%. Duration 2
hours.
9. How many layers does have the TCP/IP architecture? List them.
Five: Application, Transport, Network, Data Link Layer, Physical Layer
10.In the client/server model, who does start the connection the client or the
server?
The client starts the connection
12.What command you may use in Linux to access a Windows' shared folder?
smbclient
14. What is the syntax of an HTTP request line (1st line of a request)?
<method><space><url><space><HTTP/<version>><CR><LF>
17.A program has received DatagramPacket dp. Write the code to print to the
standard output the text contained in this datagram.
String text = new String(dp.getData(),0,dp.getLength());
System.out.println(text);
21.A web browser downloads a web page that contains four images.
Neglecting the transmission time, how many round trip times (RTT) will the
download take if HTTP 1.1 is used?
Six: one for connection plus five additional objects.
26.How many threads does have a Java program that starts just one thread
from main method?
Two: the main thread plus the additional one it's been just created.
27.Write Java code that waits till a connection is made on SeverSocket ss and
then it prints the IP remote port of the socket.
Socket s=ss.accept();
System.out.println(s.getPort());
28.Write Java code to read a text line from Socket s and print it to the
standard output.
Scanner in = new Scanner(s.getInputStream());
System.out.println(in.nextLine());
29.In the declaration PrintWriter out = new PrintWriter(os, true);
What is the purpose of the second parameter (true)?
It forces an automatic flush every time println() method is invoked.
30.Write Java code that prints whether port 1055 on localhost is open
(accepting connections) or closed.
try {Socket s=new Socket("localhost",1055); System.out.println("OPEN"); }
catch(IOException e) {System.out.println("CLOSED"); }
45.What happens to the delivery ratio when a network gets congested? Why?
It drops dramatically. When the network gets congested some packets are
dropped by routers.
50.If the sequence numbers of two consecutive TCP segments are 11200 and
11400. How many data bytes does the first segment contain?
It contains bytes from 11200 to 11399, that is 200 bytes.