0% found this document useful (0 votes)
8 views5 pages

Network Programming Exam Q&A Guide

The document is a comprehensive guide on network programming, featuring 50 extensive exam questions and answers covering key concepts such as client-server systems, TCP vs. UDP, socket programming, and network security. It explains important topics like the TCP handshake, DNS, firewalls, and load balancing, providing examples and definitions for clarity. This guide serves as a valuable resource for understanding fundamental networking principles and practices.

Uploaded by

joshuaonyango372
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Network Programming Exam Q&A Guide

The document is a comprehensive guide on network programming, featuring 50 extensive exam questions and answers covering key concepts such as client-server systems, TCP vs. UDP, socket programming, and network security. It explains important topics like the TCP handshake, DNS, firewalls, and load balancing, providing examples and definitions for clarity. This guide serves as a valuable resource for understanding fundamental networking principles and practices.

Uploaded by

joshuaonyango372
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Final Comprehensive Network Programming Guide

50 Extensive Exam Questions & Answers

1. **Define a client-server system and provide an example.**


- A client-server system is a distributed computing model where clients request services, and servers
provide them.
- Example: A web browser (client) requesting a webpage from a web server.

2. **Explain the differences between TCP and UDP with examples.**


- TCP: Reliable, connection-oriented (e.g., web browsing).
- UDP: Unreliable, connectionless (e.g., video streaming).

3. **How does the TCP three-way handshake work? Explain each step.**
- SYN: Client sends connection request.
- SYN-ACK: Server acknowledges and responds.
- ACK: Client confirms, and connection is established.

4. **What are sockets and how are they used in network programming?**
- Sockets provide endpoints for sending/receiving data in network applications.

5. **What is the structure of an IPv4 socket address?**


```c
struct sockaddr_in {
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
```

6. **Explain the role of middleware in distributed systems.**


- Middleware provides communication between distributed applications, abstracting low-level network
details.

7. **What is RPC and why is it used in networking?**


- Remote Procedure Call (RPC) allows executing functions on remote machines as if they were local.
8. **How does a concurrent server handle multiple clients?**
- Uses threading, forking, or asynchronous I/O to manage multiple connections.

9. **What is the purpose of the select() function in socket programming?**


- Monitors multiple sockets to check which are ready for reading/writing.

10. **What are zombie processes and how do you prevent them?**
- Zombie processes occur when a child process exits but its parent does not read its exit status.
- Solution: Use `waitpid()` or handle `SIGCHLD`.

11. **Explain the role of DNS in networking.**


- DNS maps domain names to IP addresses.

12. **What is a proxy server and how does it work?**


- A proxy server acts as an intermediary between clients and the internet.

13. **How does a firewall impact network traffic?**


- A firewall filters network traffic to block unauthorized access.

14. **What is the difference between unicast, multicast, and broadcast?**


- Unicast: One-to-one communication.
- Multicast: One-to-many communication (selected receivers).
- Broadcast: One-to-all communication.

15. **Explain the concept of load balancing in network applications.**


- Load balancing distributes traffic across multiple servers to improve performance.

16. **How does SSL/TLS enhance network security?**


- Provides encryption and authentication for secure data transmission.

17. **What is NAT (Network Address Translation)?**


- NAT maps private IP addresses to public ones, allowing multiple devices to share a single IP.

18. **Explain the difference between IPv4 and IPv6.**


- IPv4: 32-bit addresses, supports ~4 billion devices.
- IPv6: 128-bit addresses, supports a virtually unlimited number of devices.

19. **What is a socket descriptor?**


- A file descriptor representing a network connection.

20. **How does TCP handle flow control?**


- Uses the sliding window protocol to regulate data transmission rates.

21. **Explain how connection termination occurs in TCP.**


- Uses the four-step FIN-ACK handshake.

22. **What is the significance of TIME_WAIT in TCP?**


- Ensures all packets have been received before closing the connection.

23. **How do you monitor active TCP connections using Linux commands?**
- Use `netstat -an | grep ESTABLISHED`.

24. **What are the key fields in a TCP header?**


- Source port, destination port, sequence number, acknowledgment number, flags.

25. **How does the select() function manage multiple connections?**


- Allows a program to monitor multiple sockets and detect activity.

26. **What is a network protocol stack?**


- A layered model (e.g., OSI, TCP/IP) defining network communication.

27. **How does the accept() function work in a server?**


- Blocks until a client connects, then returns a new socket for communication.

28. **What is a connection-oriented protocol?**


- A protocol that establishes a reliable connection before transmitting data (e.g., TCP).

29. **Explain the different TCP congestion control mechanisms.**


- Slow start, congestion avoidance, fast retransmit, fast recovery.

30. **What is the purpose of SO_REUSEADDR in socket programming?**


- Allows a socket to bind to a port that is in a TIME_WAIT state.

31. **What are the advantages of using multithreading in a server?**


- Improves performance by handling multiple clients concurrently.
32. **What is the purpose of the htons() function?**
- Converts a number to network byte order.

33. **How does a router function in a network?**


- Forwards packets between different networks.

34. **What is the role of an HTTP server?**


- Serves web pages to clients using the HTTP protocol.

35. **Explain the different layers of the OSI model.**


- Physical, Data Link, Network, Transport, Session, Presentation, Application.

36. **What are the benefits of using IPv6?**


- Larger address space, better security, simplified header.

37. **How does a TCP retransmission work?**


- If an acknowledgment is not received, TCP retransmits the lost packet.

38. **What is a SYN flood attack?**


- A Denial-of-Service attack that overwhelms a server with SYN requests.

39. **Explain the role of a DHCP server.**


- Automatically assigns IP addresses to network devices.

40. **What is a VPN and how does it enhance security?**


- A Virtual Private Network encrypts internet traffic, providing secure remote access.

41. **What is the difference between HTTP and HTTPS?**


- HTTPS encrypts data using SSL/TLS.

42. **How does ARP (Address Resolution Protocol) work?**


- Maps an IP address to a MAC address within a local network.

43. **What is ICMP used for in networking?**


- Sends error messages (e.g., used in ping).

44. **What is the main purpose of the TTL field in an IP packet?**


- Prevents packets from looping indefinitely.
45. **How does the traceroute command work?**
- Displays the path packets take to a destination.

46. **What is the function of a network switch?**


- Forwards data packets based on MAC addresses.

47. **How does DNS caching improve network performance?**


- Reduces lookup times by storing previously resolved domain names.

48. **What are the differences between a modem and a router?**


- A modem connects to the ISP, while a router distributes the connection to multiple devices.

49. **What is a subnet mask and why is it used?**


- Determines the network and host portions of an IP address.

50. **How does load balancing work with multiple servers?**


- Distributes client requests across servers to optimize performance.

Common questions

Powered by AI

The TIME_WAIT state in TCP ensures that all packets from a session have been received and any delayed duplicates are invalidated before a connection closes completely. This prevents old connection instances from interfering with new ones and contributes to overall network stability by guaranteeing a clean connection termination .

TCP is reliable and connection-oriented, ensuring data integrity through error checking and acknowledgment of receipt (e.g., web browsing), while UDP is unreliable, connectionless, and does not guarantee delivery (e.g., video streaming). These differences impact applications' choice based on their need for reliability versus speed and efficiency .

IPv4 uses 32-bit addresses, supporting roughly 4 billion devices, reaching address exhaustion. IPv6, with 128-bit addresses, supports a virtually limitless number of devices, addressing current scarcity and preparing for future growth. IPv6 also offers improved security and simplified headers, positively impacting scalability and management in future infrastructures .

The TCP three-way handshake establishes a reliable connection by coordinating the transmission states between the client and the server. It begins with the client sending a SYN packet to request a connection. The server responds with a SYN-ACK packet, acknowledging the request and offering to establish a session. Finally, the client sends an ACK packet to confirm the connection, allowing data transmission to commence .

VPNs enhance network security by encrypting internet traffic, creating a secure tunnel for data transmission. This increases data confidentiality and ensures that sensitive information is inaccessible to unauthorized users, thereby reducing susceptibility to eavesdropping and enhancing overall privacy and security .

TCP manages congestion using mechanisms such as slow start, congestion avoidance, fast retransmit, and fast recovery. Slow start increases the congestion window gradually to avoid overwhelming the network. Congestion avoidance adjusts the window size more conservatively after reaching a threshold. Fast retransmit quickly resends lost packets upon detecting missing acknowledgments, and fast recovery allows recovery without restarting the slow start process, thus maintaining network stability .

Middleware acts as an intermediary layer that abstracts the complexity of network communications. It facilitates interaction between distributed applications by providing a consistent interface and managing aspects such as messaging, synchronization, and data translation, allowing applications to communicate without needing to handle low-level network details .

Routers maintain network functionality by directing data packets between different network segments, ensuring data reaches its appropriate destination through the most efficient paths. They play critical roles in traffic management, avoiding congestion, and ensuring security by filtering packets based on predetermined policies .

The select() function monitors multiple file descriptors to see if they are ready for reading or writing, enabling efficient management of multiple connections in a server. It blocks execution until one or more sockets become active. However, it's limited by the number of file descriptors it can handle and is less efficient in scaling to a large number of simultaneous connections compared to more modern techniques like epoll or kqueue .

DNS is essential as it translates human-readable domain names into IP addresses, enabling user navigation across the internet. Efficient DNS operations improve user experience by reducing access times through caching and optimizing lookup processes, thereby enhancing browsing speed and reliability .

You might also like