🎓 BookMCQ
← Back to 26. Standard Client Server Protocols

📝 FTP protocol in computer networks (12 MCQs)

FTP for File Transfer Between Hosts

The File Transfer Protocol (FTP) is an application-layer protocol for transferring files between a client and a server. It supports user authentication, directory navigation, file listing and file upload or download. FTP uses TCP connections and separates command control from file data, allowing a session to manage operations independently of the transferred file stream. This design separates session control from the potentially lengthy movement of file contents.

Separate Protocol Control and Data Functions

An FTP client contains a user interface and protocol interpreter, while the server has a protocol interpreter and data-transfer process. The control connection carries commands and replies; a separate data connection carries directory listings or file contents. User credentials and transfer parameters are negotiated over the control channel. The arrangement lets clients manage transfers without mixing command text with file bytes.

Login, Directory Navigation and Transfer Sequence

The client opens a control connection to the server, traditionally on TCP port 21, and receives a greeting. It sends commands such as USER, PASS, PASV, RETR or STOR. The server replies with numeric codes, and when a transfer is needed the endpoints establish a separate data connection for the file or listing.

Uploading a File to an FTP Server

A client can connect to an FTP server, authenticate, change to the /reports directory and issue RETR summary.pdf. The server accepts the command, establishes the negotiated data path, sends the file bytes, and closes that data connection after completion. The control session can remain available for another command. The sequence demonstrates why a successful command and completed data transfer are separate events.

FTP's Use of TCP and Its Application Context

FTP relies on TCP for reliable byte-stream transport, but it does not itself provide encryption in its basic form. Active and passive modes determine how the data connection is established. FTP is distinct from SFTP, which operates through SSH, and from FTPS, which adds TLS protection to FTP connections. This separation supports repeated operations within one authenticated control session.

FTP Behavior Commonly Misunderstood

'FTP sends file data on the control connection' overlooks its separate data channel; control commands and replies use a different connection. 'FTP is automatically encrypted' is false for ordinary FTP. 'Port 20 is always the data port' is an oversimplification because active and passive arrangements use different endpoint ports. These distinctions are essential when diagnosing blocked ports or incomplete file transfers.

Recognizing FTP Ports, Modes and Commands

Identify TCP port 21 as the traditional control port and distinguish active from passive data setup. Interpret USER, PASS, LIST, RETR and STOR by their roles. Explain why a transfer may fail even after login succeeds, and compare FTP with FTPS and SFTP without treating the three names as interchangeable protocols.

FTP Session and Transfer Terms

  • FTP - Transfers files between networked hosts.
  • Control connection - Carries FTP commands and replies.
  • Data connection - Carries file bytes or listings.
  • RETR - Requests a server file download.
  • STOR - Uploads a file to server storage.
  • Passive mode - Lets the client open the data channel.
4
Easy
5
Medium
3
Hard

📝 All FTP protocol in computer networks MCQs

Q1. What does FTP stand for?

A.File Transfer Protocol ✅
B.Fast Transmission Procedure
C.File Transfer Process
D.Fixed Transfer Protocol
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: FTP is an acronym for File Transfer Protocol. This protocol was defined in the early days of the Internet to enable the transfer of files between a client and a server. Understanding the full name is essential because it distinguishes FTP from other protocols that may have similar abbreviations.

Q2. In passive FTP mode, the client initiates both control and data connections. Which port range does the client typically use to receive the data connection from the server?

A.Ports 20‑21
B.Ports 1024‑65535 ✅
C.Ports 0‑1023
D.Port 21 only
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Passive mode requires the client to open a high‑numbered, unprivileged port (typically above 1024) to accept the incoming data connection from the server. This avoids firewall restrictions on low‑numbered ports and is why the 1024‑65535 range is commonly used for the client‑side data channel.

Q3. Which statement correctly contrasts FTP and SFTP?

A.FTP encrypts data while SFTP does not
B.FTP uses UDP while SFTP uses TCP
C.SFTP provides encryption and authentication ✅
D.FTP supports resume while SFTP does not
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: SFTP (SSH File Transfer Protocol) operates over an encrypted SSH channel, providing both confidentiality and authentication. In contrast, standard FTP transmits credentials and data in clear text, offering no built‑in security. This fundamental difference makes SFTP the preferred choice when protecting sensitive file transfers.

Q4. When transferring a large file over FTP, which TCP feature most directly impacts throughput?

A.Slow start
B.Sliding window
C.Three‑way handshake
D.Congestion control ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Congestion control algorithms adjust the sending rate based on perceived network congestion, directly influencing how quickly large volumes of data can traverse the connection. While slow start and sliding windows affect initial behavior, congestion control determines the sustained throughput over the duration of a long FTP transfer.

Q5. An organization blocks outbound traffic on port 21 but allows outbound traffic on port 20. Which FTP mode would most likely succeed for a client inside the network?

A.Active
B.Passive ✅
C.Both
D.Neither
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Passive mode is client‑initiated for both control and data channels, so the client can connect to the server’s listening port (usually 21) and then request a data connection on a high‑numbered port. Since outbound port 21 is blocked, the client can still receive the data connection on an allowed port, making passive mode the viable option.

Q6. Compare FTP active and passive modes regarding NAT traversal. Which statement is most accurate?

A.Active mode requires the server to open a listening port
B.Passive mode requires the client to listen
C.Active mode works better with NAT
D.Passive mode is generally more NAT‑friendly ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: NAT devices typically block inbound connections that are not associated with an outbound request. In passive mode, the client initiates both control and data connections, allowing NAT to map the outbound request and accept the returning data. Active mode, which requires the server to connect back to the client, often fails behind NAT.

Q7. When uploading a file, which sequence of FTP commands correctly initiates a binary transfer and stores the file on the server?

A.STOR then TYPE I
B.TYPE I then STOR ✅
C.PASV then TYPE I
D.USER then PASS
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct order is to first set the transfer mode to binary with the TYPE I command, ensuring that the data is not altered, and then issue the STOR command to store the file on the server. Reversing the order could cause the server to treat the data as ASCII, potentially corrupting binary files.

Q8. Evaluate FTP versus HTTP for distributing large files. Which advantage uniquely belongs to FTP?

A.FTP uses persistent connections
B.HTTP uses pipelining
C.FTP allows resume of interrupted transfers ✅
D.HTTP compresses data
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: FTP includes explicit commands (e.g., REST) that enable the client to resume a partially transferred file without restarting from the beginning. While HTTP/1.1 also supports range requests, FTP’s native resume capability has been historically more reliable for large, multi‑gigabyte transfers, making it a distinct advantage.

Q9. Which FTP extension adds integrity checking using checksums?

A.FTP with MD5 ✅
B.FTPS (FTP over TLS)
C.SFTP (SSH File Transfer)
D.FTP over SSL/TLS
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The FTP‑MD5 extension defines a new command that allows the client to request an MD5 checksum of a file on the server, providing a way to verify that the transferred data matches the original. This mechanism adds integrity verification without encrypting the entire session, differentiating it from FTPS or SFTP.

Q10. A 500 MB file is transferred over an FTP connection that experiences a 20 % overhead due to TCP retransmissions. If the raw TCP throughput is 10 Mbps, approximately how many seconds will the transfer take?

A.400 seconds
B.440 seconds
C.500 seconds ✅
D.560 seconds
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Effective throughput = 10 Mbps × (1 − 0.20) = 8 Mbps. Convert 500 MB to megabits: 500 × 8 = 4000 Mbit. Transfer time = 4000 Mbit ÷ 8 Mbps = 500 seconds. Therefore, the transfer will take roughly 500 seconds, corresponding to answer C.

Q11. In the context of anonymous FTP login, which security implication is most accurate?

A.It prevents any authentication
B.It limits user privileges ✅
C.It encrypts credentials
D.It uses port 22
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Anonymous FTP allows anyone to log in using a generic username (often “anonymous”) without a password, but the server typically restricts the account to read‑only access or a confined directory. This limitation mitigates potential damage while still providing public access to files.

Q12. In a hybrid P2P‑FTP architecture, which mechanism best ensures data integrity when multiple peers serve fragments of a file?

A.Centralized checksum server
B.Distributed hash table with per‑chunk hashes ✅
C.Use of FTP passive mode
D.Reliance on TCP sequence numbers
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A distributed hash table (DHT) can store a cryptographic hash for each file chunk. Peers verify each fragment against its hash before assembling the complete file, guaranteeing integrity even when fragments come from different sources. This decentralized approach scales well and aligns with the peer‑to‑peer nature of the system.

🔗 Related Topics (MCQs)