📝 BitTorrent protocol explained (10 MCQs)
Swarm-Based Distribution of File Pieces
BitTorrent is a peer-to-peer file distribution protocol in which a file is divided into pieces that participating clients exchange. A peer can download pieces from several sources and upload pieces it already has to others. A swarm is the group of peers participating in distribution of the same torrent. Peer discovery locates sources, while peer sessions carry the actual content pieces.
Metainfo, Piece Hashes, and Peer Connections
A torrent's metainfo describes the content, piece length, and hashes used to verify pieces. The info-hash identifies the torrent's info dictionary. Peers discover one another through a tracker or a DHT, then establish peer connections and exchange protocol messages describing interest and available pieces. Discovery records identify sources but do not carry the requested file.
Handshake, Requests, and Piece Messages
After connecting, peers exchange a BitTorrent handshake identifying the torrent and peer. They communicate availability using bitfield or have messages, express interest, and use choke or unchoke decisions. A requester sends a request for a block within a piece; the provider replies with a piece message. Peer messages coordinate availability and requests after discovery completes.
Downloading and Verifying a Piece
Suppose a torrent contains a piece whose expected SHA-1 hash is stored in metainfo. A client requests its blocks from a peer, assembles the complete piece, and calculates the hash. Matching the expected value indicates the piece passed this integrity check, after which the client can advertise it with have. The transfer path is separate from the directory or DHT path.
Swarm Efficiency and Peer Cooperation
Piece exchange allows multiple peers to contribute upload capacity, while rare-piece selection can help distribute less common data. Choking and unchoking regulate which peers receive service. Trackers or DHTs help locate peers, but the payload is exchanged over peer connections rather than through the tracker. Discovery resilience cannot guarantee peer uptime or completed downloads alone.
Pieces Are Not the Same as Request Blocks
'A tracker transfers the file' is false because it supplies peer information. 'A peer message request always asks for a complete piece' ignores block offsets and lengths within a piece. 'A received block is trusted immediately' overlooks piece-hash verification after assembly. These roles explain why control messages and content travel separately.
Metainfo Fields and Peer-Wire Message Tracing
Be able to identify the info-hash, piece length, piece hashes, and peer IDs, then trace handshake, bitfield or have, interested, unchoke, request, and piece messages. Distinguish piece indices from block offsets, and explain how hash verification detects corrupted content before it is shared further. Separate discovery messages, peer commands, data blocks, and verification steps.
BitTorrent Peer Exchange and Metainfo Terms
- Swarm - Peers participating in one torrent..
- Piece - Fixed size part of a shared file..
- Block - Requested byte range within a piece..
- Info-hash - Hash identifying torrent info dictionary..
- Bitfield - Message listing pieces held by peer..
- Choke - State preventing peer requests from being served..
📝 All BitTorrent protocol explained MCQs
Q1. What is the primary function of a tracker in the original BitTorrent protocol?
📖 Explanation: The tracker does not hold any file chunks; its role is to keep a dynamic directory that maps torrent identifiers to the IP addresses of peers that currently possess those files. When a client contacts the tracker, it receives a list of peers to connect with, making option B the correct choice.
Q2. If a peer stops sending 'have' messages after downloading a piece, what is the most likely immediate effect on other peers' download strategy?
📖 Explanation: Peers rely on 'have' messages to learn which pieces are available elsewhere. When a peer ceases to announce possession of a piece, other peers interpret the lack of notification as the piece being unavailable, prompting them to avoid requesting it. Hence, the most immediate effect is the assumption that the piece cannot be obtained, making option B correct.
Q3. In a trackerless BitTorrent network that uses Kademlia, how does a large XOR distance between a node and a target key affect the node's ability to locate the desired piece?
📖 Explanation: Kademlia organizes nodes in a binary key space where distance is measured by XOR. A larger XOR distance means the node is farther from the target key, requiring more hops through intermediate nodes to reach the responsible peer. Consequently, the search takes longer, so option B accurately describes the effect.
Q4. Suppose a torrent swarm contains 100 peers, each with an upload capacity of 0.5 Mbps, and the original seed has a download capacity of 2 Mbps. If the seed stops uploading, what is the maximum sustainable download rate for any individual peer, assuming perfect tit‑for‑tat fairness?
📖 Explanation: With the seed no longer contributing upload bandwidth, the total upload capacity in the swarm is 100 × 0.5 Mbps = 50 Mbps. Under perfect tit‑for‑tat, each peer can download at most the average share of this upload capacity, which is 50 Mbps / 100 = 0.5 Mbps. Therefore, the highest sustainable download rate per peer is 0.5 Mbps, making option A correct.
Q5. Which of the following statements best compares centralized (tracker‑based) and decentralized (trackerless) BitTorrent architectures?
📖 Explanation: In a centralized model, a tracker acts as a single point that maintains the list of peers, creating a potential failure point. Decentralized (trackerless) systems replace this with a distributed hash table where each peer contributes to the directory, eliminating a single point of failure. Thus, option A captures the core distinction.
Q6. How does the choke/unchoke algorithm influence fairness in a BitTorrent swarm?
📖 Explanation: The choke/unchoke mechanism evaluates the upload rates received from each neighbor and preferentially unchokes those that contribute the most data. This reciprocal incentive promotes fairness by rewarding peers that share bandwidth, while penalizing free‑riders. Consequently, option B correctly describes the algorithm's impact on fairness.
Q7. What is the primary trade‑off when choosing a larger piece size for a torrent file?
📖 Explanation: Increasing piece size means fewer pieces overall, which lowers the number of protocol messages (reducing overhead). However, if a piece is rare, a larger block takes longer to obtain, raising latency for that scarce piece. This balance of reduced overhead versus higher latency for rare pieces is captured in option A.
Q8. Applying the rarest‑first strategy, what is the expected effect on overall swarm health when a newly joined peer selects the rarest piece it does not have?
📖 Explanation: The rarest‑first policy directs peers to request the pieces that have the fewest copies in the swarm. By doing so, it spreads those scarce pieces more quickly, preventing bottlenecks and ensuring a more uniform distribution of all pieces. This improves overall swarm health, making option B the correct answer.
Q9. In a Distributed Hash Table (DHT) used by trackerless BitTorrent, how is churn (peers frequently joining and leaving) typically mitigated?
📖 Explanation: DHTs handle churn by continuously updating routing buckets; nodes ping neighbors to confirm liveness and replace failed entries. Additionally, key‑value pairs are replicated to nodes that are close in the XOR space, ensuring that the loss of a single node does not erase data. This combination of bucket refresh and replication is described in option B.
Q10. What is the relationship between the size of a BitTorrent swarm and the average download speed experienced by its members?
📖 Explanation: A larger swarm means more peers contributing upload bandwidth, which increases the total pool of data that any individual can download. While extreme congestion can occur, in typical scenarios the added capacity outweighs coordination overhead, resulting in higher average download speeds. Therefore, option A correctly describes the relationship.