How to evaluating a software engineer computer network knowledge and network programming skills?

Choice (10 * 2)

1, a TCP connection has been established, the host B sends A two consecutive TCP segments to the host, each comprising 300 bytes and 500 bytes of the payload between the host A and the host B, the sequence number of the first segment after 200, the host b correctly receives two segments, acknowledgment sequence number sent to the host a is ______. (2009 PubMed 408 questions)

A.500

B.700

C.800

D.1000

Parsing: C

No test data and validation of TCP.

TCP is a byte-oriented stream that selects acknowledgment (Selective ACK) mechanism on the receiving end confirmation byte number, it returns the next sequence number the receiving side desires to receive a serial number, thus returned to the host after receiving two segments B a host acknowledgment sequence number is 1000.

 

2, a TCP connection always to the maximum segment length of 1KB TCP segments sent, the sender has enough data to transmit. When a timeout occurs when the congestion window is 16KB, if the transmission of TCP segment within the next four RTT (round trip time) time are successful, then all the TCP segment when the RTT time within the first four have been sent acknowledgment when the congestion window size is ______. (2009 PubMed 408 questions)

A.7 KB

B.8 KB

C.9 KB

D.16 KB

Parsing: D

TCP's congestion control test method.

Whether or congestion avoidance phase in the slow start phase, as long as the sender to determine the network congestion (based on confirmation is not received on time), we should slow start threshold ssthresh is set to appear half (but the window when the value of the sender's congestion not less than 2). Then the congestion window cwnd is reset to 1, execute slow start algorithm. The aim is to quickly reduce the number of packets sent to the host in the network, so that the router of congestion have sufficient time to packet queue backlog processed. Thus, after the transmission of the congestion, the slow start threshold ssthresh becomes 16/2 = 8 KB, the transmitting window becomes 1 KB. In the next three the RTT, the slow start algorithm performs congestion window, increased exponentially 8 KB, this time due to the slow start threshold ssthresh is 8 KB, and therefore congestion avoidance algorithm is executed instead, i.e. the congestion window start "by adding Big". Thus after the 4th RTT, the congestion window size is 9 KB.

 

3, if the IP router to discard packets due to congestion R, R at this time may be sent to the source host ICMP packet type of the IP packet is transmitted ______. (2010 PubMed 408 questions)

A. Route Redirection

B. Destination Unreachable

C. Source inhibition

D. time out

Parsing: C

Examine the ICMP protocol.

ICMP error report message has 5, the end is not reachable, source-quench, over time, parameters of the problem, the rerouting (redirection), wherein the source is suppressed when the router or host datagram is discarded due to congestion, on the source inhibiting transmission source packets, so that the source knows the transmission rate should be slow datagrams.

 

4, if no local domain name server cache, when using a host domain name parsing recursion another network, user host, the local domain name server requests sent message ______ respectively. (2010 PubMed 408 questions)

A. One, a

B. One, a number of

C. Multiple, a

D. multiple, multiple

Parsing: A

DNS name resolution process to examine the system.

When recursive query methods to resolve domain names, if the host asks the local domain name server does not know the queried domain name IP address, local domain name server to DNS client, to continue to issue queries to other root name server request packet, this method host and domain name server the local transmission requests are a number of pieces.

 

5、TCP/IP参考模型的网络层提供的是_____。 (2011考研408试题)

A.无连接不可靠的数据报服务

B.无连接可靠的数据报服务

C.有连接不可靠的虚电路服务

D.有连接可靠的虚电路服务

解析:A。

TCP/IP的网络层向上只提供简单灵活的、无连接的、尽最大努力交付的数据报服务。此外考察IP首部,如果是面向连接的,则应有用于建立连接的字段,但是没有;如果提供可靠的服务,则至少应有序号和校验和两个字段,但是IP分组头中也没有(IP首部中只是首部校验和)。因此网络层提供的无连接不可靠的数据服务。有连接可靠的服务由传输层的TCP提供。

 

6、若某通信链路的数据传输速率为2400bps,采用4相位调制,则该链路的波特率是_____。 (2011考研408试题)

A.600波特

B.1200波特

C.4800波特

D.9600波特

解析:B。

有 4 种相位,则一个码元需要由 log24=2 个 bit 表示,则波特率=比特率/2=1200波特。 

 

7、ARP 协议的功能是_____ 。 (2012考研408试题)

A.根据 IP 地址查询 MAC 地址 

B.根据 MAC 地址查询 IP 地址

C.根据域名查询 IP 地址 

D.根据 IP 地址查询域名

解析:A

考查 ARP 协议的功能。

在实际网络的数据链路层上传送数据时,最终必须使用硬件地址,ARP 协议是将网络层的 IP 地址解析为数据链路层的 MAC 地址。

 

8、某主机的 IP 地址为 180.80.77.55,子网掩码为 255.255.252.0。若该主机向其所在子网发送广播分组,则目的地址可以是_____ 。(2012考研408试题)

A.180.80.76.0

B.180.80.76.255

C.180.80.77.255

D.180.80.79.255

解析:D

考查 IP 地址的特点。

由子网掩码可知前 22 位为子网号、后 10 位为主机号。IP 地址的第 3 个字节为 01001101(下划线为子网号的一部分),将主机号全置为 1,可得广播地址为 180.80.79.255。

 

9、站点 A、B、C 通过 CDMA 共享链路,A、B、C 的码片序列(chipping sequence)分别是(1,1,1,1)、(1,-1,1,-1)和(1,1,-1,-1)。若 C 从链路上收到的序列是(2,0,2,0,0,-2,0,-2,0,2,0,2), 则 C 收到 A 发送的数据是____ 。

A.000 B.101 C.110 D.111

解析:B

把收到的序列分成每 4 个数字一组,即为(2,0,2,0)、(0,-2,0,-2)、(0,2,0,2),因为题目求的是 A 发送的数据,因此把这三组数据与 A 站的码片序列(1,1,1,1)做内积运算,结果分别是(2,0,2,0)·(1,1,1,1)/4=1、(0,-2,0,-2)·(1,1,1,1)/4=-1、(0,2,0,2)·(1,1,1,1)/4=1,所以 C 接收到的 A 发送的数据是 101,选 B。

 

10、对于 100Mbps 的以太网交换机,当输出端口无排队,以直通交换(cut-through switching)方式转发一个以太网帧(不包括前导码)时,引入的转发延迟至少是_____。

0 μs

B. 0.48 μs

C. 5.12 μs

D. 121.44 μs

解析:B

直通交换方式是指以太网交换机可以在各端口间交换数据。它在输入端口检测到一个数据包时,检查该包的包头,获取包的目的地址,启动内部的动态查找表转换成相应的输出端口,在输入与输出交叉处接通,把数据包直通到相应的端口,实现交换功能。通常情况下,直通交换方式只检查数据包的包头即前 14 个字节,由于不需要考虑前导码,只需要检测目的地址的 6 B,所以最短的传输延迟是 0.48μs。

 

填空题(5*2)

11、计算机网络的主要功能有 通信、 资源共享、 分布计算、 提高可靠性。

 

12、冲突窗口是从数据发送开始到网络上最远的两个站之间信号传播时延的两倍止的时间区间

 

13、对于 4KHz 的电话每秒采样 8K 次如用 8bit 来表示每个采样值若要传 32 路电话则要求信道带宽为 32*8*8K=2.048 Mbps

 

14、网络应用系统通信模型称为 客户/服务器模型Client/Server 。

 

15、网络上两个进程之间进行通信需要用一个五元组来标识本地主机地址、本地端口号、协议、远程主机地址、远程端口号

 

简答题(4*5)

16、什么是端口,网络通信中为什么要引入端口?

解析:

端口是TCP/IP协议簇中,应用层进程与传输层协议实体间的通信接口。端口是操作系统可分配的一种资源;应用程序(进程)通过系统调用与某端口绑定(binding)后,传输层传给该端口的数据都被相应进程接收,相应进程发给传输层的数据都通过该端口输出。

 

17、HTTP协议的内容有哪些?

解析:

HTTP请求信息;

HTTP方法;

HTTP响应信息;

URL;

HTTP流程。

 

18、在IE地址栏中输入域名后的HTTP流程。

解析:

(1)URL自动解析;

(2)获取IP,建立TCP连接;

(3)客户端浏览器向服务器发出HTTP请求;

(4)Web服务器应答,并向浏览器发送数据;

(5)Web服务器关闭TCP连接。

 

19、试分析面向连接的服务器和无连接的服务器各自的优缺点。(电子科技大学网络编程考试)

解析:

(1)

面向连接的服务的优点:

易于编程;

自动处理分钟丢失,分组失序;

自动验证数据差错,处理连接状态

面向连接的服务的缺点:

在每个连接都有一个单独的套接字,耗费更多的资源

在空闲的连接上不发送任何分组

始终运行的服务器会因为客户的崩溃,导致无用套接字的过多而 耗尽资源

(2)

无连接服务的优点:

没有资源耗尽问题

无连接服务缺点:

需要自己完成可靠通信问题,必要时,需要一种自适应重传的复 杂技术,需要程序员具有相当的专业知识,对于可靠通信的场合, 尽量使用TCP。

 

编程题(30)

20、TCP客户端需要向服务器端8629发出连接请求,与服务器进行信息交流,当收到服务器发来的是“BYE”时,立即向对方发送“BYE”,然后关闭连接,否则,继续向服务器发送信息。

 

import java.io.*;

import java.net.*;

  class Client2{

 public Client2()

 {  try

  {String s;

   Socket socket = new Socket("服务器地址", 8629);   

   BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

   PrintWriter out = new PrintWriter(socket.getOutputStream(),true);

   BufferedReader line = new BufferedReader(new InputStreamReader(System.in));

    while(true)

  { System.out.println("请向服务器输出一条字符串:");

    s=line.readLine();

     out.println(s);                 //向服务器发出信息;

     s=in.readLine().trim();               //收到服务器发来的信息;

     System.out.println("服务器返回的信息是:");

      System.out.println(s);

    if(s.equals("BYE"))

    { out.println("BYE");

      

      line.close();

      out.close();

      in.close();

       socket.close();  break;}

    }   

        }

  catch (IOException e){}

 }

 public static void main(String[] args) {

  new Client2();

 }}

import java.io.*;

  import java.net.*;

 class Server {

 public static void main(String[] args) {  

  new UDPServer() ; }

}

 

class UDPServer   {

 public UDPServer() {  

    try {

   DatagramSocket socket = new DatagramSocket(1986); //建立一个Socket连接

   System.out.println("服务器IP:" + InetAddress.getLocalHost().getHostAddress()); //显示服务器信息

   while (true) {

    // 接收

    byte[] instr = new byte[200];

    DatagramPacket receive = new DatagramPacket(instr, instr.length);

    socket.receive(receive);  //接收客户机发过来的数据

    String str = new String(receive.getData());  //提取数据

    if(str.trim().equals("BYE"))

    {socket.close();break;}

    System.out.println("收到客户端消息:" + str.trim()); //打印客户机消息

    // 发送

    System.out.print("服务器发送消息:");

    str = new BufferedReader(new InputStreamReader(System.in)).readLine(); //得到输入的数据

    byte[] outstr = new byte[str.length()];

    outstr = str.getBytes();

    DatagramPacket send = new DatagramPacket(outstr,outstr.length, receive.getAddress(), receive.getPort()); //向客户机发送数据

    socket.send(send); //执行发送

   }   

  } catch (Exception e) {

   //错误处理

   //e.printStackTrace();

  }

 }

}
UDP发送端

   import java.io.*;

  import java.net.*;

class Client {

 public static void main(String[] args) {

  new UDPClient();

 }

}

class UDPClient  {

 public UDPClient() {

  System.out.print("请输入服务器的地址:");

  String serverip = null;

  try {

   serverip = new BufferedReader(new InputStreamReader(System.in)).readLine();  //取得输入的服务器地址

  } catch (IOException e1) {

   //错误处理

   //e1.printStackTrace();

  }

  try {

   DatagramSocket socket = new DatagramSocket(); //建立Socket

   while (true) {

    // 发送

    System.out.print("客户端发送消息:");

    String send = new BufferedReader(new InputStreamReader(System.in)).readLine(); //读入客户机输入的消息

    byte[] outstr = new byte[send.length()];

    outstr = send.getBytes();

    InetAddress address = InetAddress.getByName(serverip);

    DatagramPacket packet = new DatagramPacket(outstr, outstr.length, address, 1986); //向服务器发送数据报

    socket.send(packet); //发送数据报

    // 接收

    byte[] instr = new byte[200];

    packet = new DatagramPacket(instr, instr.length); //接收数据报

    socket.receive(packet); //接收数据

    String out = new String(packet.getData()); //取出信息

    if(out.trim().equals("BYE"))

    {socket.close();break;}

    System.out.println("收到服务器消息:" + out.trim()); //打印服务器发过来的信息

   }

  } catch (Exception e) {

   // 错误处理

   // e.printStackTrace();

  }

 }

}

 

解析题(20)

21、某公司网络如图所示。 IP 地址空间 192.168.1.0/24 被均分给销售部和技术部两个子网,并已分别为部分主机和路由器接口分配了 IP 地址,销售部子网的 MTU=1500B ,技术部子网的 MTU=800B 。

 

(1)销售部子网的广播地址是什么?技术部子网的子网地址是什么?若每个主机仅分配一个IP 地址,则技术部子网还可以连接多少台主机?

(2)假设主机 192.168.1.1 向主机 192.168.1.208 发送一个总长度为 1500B 的 IP 分组, IP 分组的头部长度为 20B,路由器在通过接口 F1 转发该 IP 分组时进行了分片。若分片时尽可能分为最大片,则一个最大 IP 分片封装数据的字节数是多少?至少需要分为几个分片?每个分片的片偏移量是多少?

(2018考研408试题)

解析:

1)广播地址是网络地址中主机号全 1 的地址(主机号全 0 的地址,代表网络本身) 。销售部和技术部均分配了 192.168.1.0/24 的 IP 地址空间, IP 地址的前 24 位为子网的网络号。 于是在后 8 位中划分部门的子网,选择前 1 位作为部门子网的网络号。令销售部子网的网络号为 0,技术部子网的网络号为 1,则技术部子网的完整地址为 192.168.1.128 ;令销售部子网的主机号全 1,可以得到该部门的广播地址为 192.168.1.127 。 每个主机仅分配一个 IP 地址,计算目前还可以分配的主机数,用技术部可以分配的主机数,减去已分配的主机数, 技术部总共可以分配计算机主机数为128-2=126(减去全 0 和全 1 的主机号)。 已经分配了 208-129+1=80 个,此外还有 1 个 IP 地址分配给了路由器的端口 (192.168.1.254) ,因此还可以分配 126-80-1=45 台。

2)判断分片的大小,需要考虑各个网段的 MTU ,而且注意分片的数据长度必须是 8B 的整数倍。由题可知,在技术部子网内, MTU=800B ,IP 分组头部长 20B,最大 IP 分片封装数据的字节数为 (800-20)/8 ×8=776 。至少需要的分片数为 (1500-20)/776 =2 。第 1 个分片的偏移量为 0;第 2 个分片的偏移量为 776/8=97 。

Guess you like

Origin www.cnblogs.com/zhang512/p/12085351.html