Practice Top 30 Python Programming Questions on Networked Applications, TechnoVlogs

Practice Top 30 Python Programming Questions on Networked Applications


Q1. Write a simple TCP server and client where the client sends "Hello" and the server responds with "Hi".
Input:  
 Client: Hello  
Expected Output:  
 Server: Hi

Q2. Create a TCP server that echoes back the messages sent by the client.
Input:  
 Client: Hello, Server!  
Expected Output:  
 Server: Hello, Server!

Q3. Implement a server that broadcasts a message from one client to all connected clients.
Input:  
 Client 1: Hello  
Expected Output:  
 Client 2: Hello

Q4. Modify the server to handle connections from multiple clients simultaneously.
Input:  
 Client 1: Hi  
 Client 2: Hello  
Expected Output:  
 Server responds to each client appropriately.

Q5. Build a basic chatroom where clients can send messages, and all clients receive them.
Input:  
 Client 1: How are you?  
 Client 2: I'm good!  
Expected Output:  
 All clients receive both messages.

Q6. Create a server that shuts down when a client sends the message "exit".
Input:  
 Client: exit  
Expected Output: Server terminates.

Q7. Implement a server and client to transfer a text file from client to server.
Input:  
 File Content: This is a test file.  
Expected Output: Server saves the file.

Q8. Allow clients to specify nicknames and include them in chat messages.
Input:  
 Client 1 (Nick: Alice): Hi!  
 Client 2 (Nick: Bob): Hello, Alice!  
Expected Output:  
 Alice: Hi!  
 Bob: Hello, Alice!

Q9. Add support for private messages using a special syntax (e.g., /msg Bob Hello).
Input:  
 Client: /msg Bob Hello  
Expected Output:  
 Only Bob receives Hello.

Q10. Log all messages exchanged in the chat to a file on the server.
Input:  
 Messages: Hi, Hello  
Expected Output: Log file contains both messages.

Q11. Include a timestamp with each message displayed to the clients.
Input:  
 Message: Hello  
Expected Output:  
 [12:34:56] Hello

Q12. Add username and password authentication for connecting clients.
Input:  
 Username: user1, Password: pass123  
Expected Output: Authentication successful!

Q13. Gracefully handle client disconnections on the server.
Input: Client disconnects.  
Expected Output: Server removes the client from the list of active clients.

Q14. Add a feature where the server can broadcast messages to all clients.
Input: Server sends Server maintenance at 10 PM.  
Expected Output: All clients receive the message.

Q15. Encrypt all messages sent between the client and server using a simple encryption scheme (e.g., Caesar cipher).
Input:  
 Client: Hello  
Expected Output: Messages exchanged as encrypted text.

Q16. Create a basic RPC server and client where the client can invoke a sum function on the server.
Input: Client sends sum(2, 3).  
Expected Output: Server returns 5.

Q17. Add support for sum, subtract, multiply, and divide RPC functions.
Input: Client sends multiply(4, 5).  
Expected Output: Server returns 20.

Q18. Handle errors in RPC calls gracefully.
Input: Client sends divide(4, 0).  
Expected Output: Server responds Division by zero error.

Q19. Use JSON to format RPC requests and responses.
Input:  
 Request: {"method": "sum", "params": [2, 3]}  
Expected Output: Response: {"result": 5}.

Q20. Add username/password authentication to the RPC server.
Input:  
 Username: admin, Password: admin123  
Expected Output: Authentication successful!

Q21. Log all RPC requests and responses on the server.
Input: Client sends sum(2, 3).  
Expected Output: Log contains the request and response.

Q22. Implement an RPC function to upload a file to the server.
Input: File: document.txt  
Expected Output: File saved on the server.

Q23. Implement an RPC function to download a file from the server.
Input: Request: download(document.txt)  
Expected Output: File sent to the client.

Q24. Handle RPC requests with nested data structures (e.g., dictionaries).
Input: sum({"a": 5, "b": 7})  
Expected Output: Server returns 12.

Q25. Add a timeout for RPC requests.
Input: Client makes a request, and the server delays response.  
Expected Output: Client receives Timeout error.

Q26. Allow the server to broadcast RPC responses to all connected clients.
Input: Server broadcasts maintenance().  
Expected Output: All clients receive the message.

Q27. Validate inputs for RPC functions on the server side.
Input: Client sends sum("a", 3).  
Expected Output: Server responds Invalid input.

Q28. Compress responses sent by the RPC server.
Input: large_data()  
Expected Output: Compressed response.

Q29. Secure the RPC server and client communication using HTTPS.
Input: RPC request: sum(2, 3)  
Expected Output: Encrypted communication.

Q30. Add a method to list all available RPC functions.
Input: Request: list_methods()  
Expected Output: ['sum', 'subtract', 'multiply', 'divide'].

Social Share

Bikki Singh Instructor TechnoVlogs

Bikki Singh

Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!