Prepare for the AP Computer Science Exam with our comprehensive quiz. Use our flashcards and multiple-choice questions to test your knowledge and uncover valuable hints. Get exam-ready today!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


How does TCP ensure message integrity?

  1. By skipping lost packets

  2. By resending lost packets and ordering them

  3. By compressing data for quicker transmission

  4. By using a faster communication protocol

The correct answer is: By resending lost packets and ordering them

TCP, or Transmission Control Protocol, is designed to ensure reliable communication over a network. One of its key mechanisms for maintaining message integrity is its ability to detect lost packets and manage their retransmission. When a packet is sent from a sender to a receiver, TCP numbers each packet with a sequence number. This sequencing enables the receiver to determine the correct order of packets, as packets could arrive out of order due to varying transmission times across the network. If any packets are missing when the receiver attempts to reassemble the message, TCP can recognize this through gaps in the sequence numbers. In this case, the protocol will request that the sender retransmits the missing packets. This process not only ensures that all data makes it to the destination but also that the data is assembled in the correct order, preserving the continuity and integrity of the message. In contrast, other choices do not contribute to message integrity in the same way. Skipping lost packets would compromise the entire communication, as data would be incomplete. Compressing data or using a faster protocol does not necessarily address the reliability or order of message delivery, which are crucial for ensuring that the communicated information remains intact and accurately represented.