Skip to content
CY-406 · Advance Python Programming/Important Questions

Advance Python Programming (CY-406) - Important Questions

  1. Unit 214 Marks High Priority

    Write a TCP server and client in Python demonstrating concurrent handling of multiple clients. The server should accept multiple simultaneous client connections, service each client (for example, echoing messages or performing a simple request-response), and correctly close connections when done. Show complete code for both server and client and include a brief explanation of how concurrency is achieved and how the server cleans up client resources.

    Core practical from Unit 2: implement end-to-end TCP client-server demonstrating concurrency with multiple clients connecting and serviced concurrently.

  2. Unit 210 Marks Medium Priority

    Write a UDP client and server in Python. The client should send numbered datagrams to the server. The server should acknowledge each received datagram. Demonstrate and explain how you would detect and handle packet loss and out-of-order delivery (for example, using sequence numbers and simple retransmission/timeouts). Provide working code for both sides and show sample client-server interaction output.

    Core UDP programming question testing datagram semantics, unreliability handling, and client/server code writing from Unit 2.

  3. Unit 27 Marks Medium Priority

    Compare TCP and UDP protocols in the context of Python socket programming. In your answer, explain differences in connection model, reliability, ordering, and typical use-cases. Also provide concise Python examples: a TCP client connecting to a TCP server and a UDP client sending a datagram to a UDP server (showing key socket calls used).

    Theory + short code examples covering protocol differences relevant to socket programming in Unit 2.

  4. Unit 210 Marks High Priority

    Implement a concurrent TCP server using Python's threading.Thread where the server spawns a new thread to handle each client connection. Provide the server and client code. Explain the advantages and drawbacks of the thread-per-connection model in Python, including discussion of the Global Interpreter Lock (GIL) and its practical implications for I/O-bound versus CPU-bound workload in network servers.

    Practical concurrency focus combining sockets and threads; connects Unit 2 socket programming with Python threading and GIL considerations.

  5. Unit 214 Marks High Priority

    Compare threading, multiprocessing, and asyncio for handling multiple clients in Python TCP servers. Discuss when each approach is appropriate (trade-offs in complexity, scalability, memory/CPU usage, and interaction with the GIL). Additionally, implement a simple producer-consumer pattern using a queue in a threaded TCP server: provide code that accepts client requests and uses worker threads from a thread pool to process requests drawn from a queue.

    Comparative question covering three concurrency approaches students must know to build scalable network clients/servers in Unit 2.

  6. Unit 210 Marks Medium Priority

    Demonstrate non-blocking sockets and the use of select.select (or the selectors module) to handle multiple TCP client connections in a single-threaded Python server. Provide code for a server that accepts multiple clients and services them using a selector-based event loop. Explain how this approach improves scalability over a thread-per-connection model and mention its limitations.

    Covers multiplexing APIs and non-blocking I/O for handling many clients in a single-threaded server from Unit 2.

  7. Unit 210 Marks Medium Priority

    Implement a simple file transfer protocol over TCP in Python. Write a client that sends a file to the server, and a server that receives the file and writes it to disk. Include a mechanism to verify file integrity (for example, sending a checksum before/after transfer). Provide client and server code and explain how you handle partial sends/receives and end-of-file detection.

    Application-level programming over TCP commonly assigned to test integration of file I/O and socket APIs in Unit 2.

  8. Unit 27 Marks Low Priority

    Explain how to secure a TCP socket connection in Python using SSL/TLS via the ssl module. Provide sample server and client code that establishes an encrypted connection, and explain steps required for certificate generation/trust for testing (self-signed certificates) and important configuration options (e.g., certificate verification mode).

    Security-oriented extension to Unit 2: applying standard library SSL to secure socket connections.

  9. Unit 27 Marks Low Priority

    Write a UDP-based time server and a client in Python. The client should request the current time from the server and display it. In your implementation, handle network byte order for time representation and implement client-side timeouts and retries. Provide both server and client code and sample output.

    Practical UDP service exercise focusing on byte order and timeout handling, applicable to Unit 2.

  10. Unit 27 Marks Low Priority

    Explain commonly used socket options (setsockopt/getsockopt) relevant to TCP servers in Python, such as SO_REUSEADDR and TCP_NODELAY. Show how to set these options in Python code and describe the practical effect each option has on server behavior (e.g., address reuse on restart, Nagle's algorithm behavior).

    Low-level socket API knowledge essential for robust TCP server implementations in Unit 2.

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in