MockExams

Purbanchal University

Network Programming (BIT401CO)

PU BIT · Semester 7 · 2025 Regular

Full marks: 80Pass marks: 32Time: 3 hours

Group A (10 Marks)

Q1[10 marks] · Unit 1 & 3: Introduction & TCP/UDP Protocols

Illustrate the TCP State Transition Diagram with special emphasis on TIME_WAIT state. Explain why 2MSL wait time is mandatory before socket closure.

OR

Differentiate between Iterative and Concurrent servers. Write a complete C socket program implementing a concurrent TCP echo server using fork().

Show solution

TIME_WAIT ensures trailing FIN/ACK segments are received and old duplicate segments expire in the network. fork() allows parent to listen while child processes client descriptor.

Q2[10 marks] · Unit 6: I/O Multiplexing

Explain I/O Multiplexing. Compare select(), poll(), and epoll() in terms of algorithmic complexity, file descriptor limits, and kernel buffer overhead.

Show solution

select() is O(N) with FD_SETSIZE limit (1024); poll() is O(N) without fixed limit; epoll() uses event-driven epoll_ctl and epoll_wait for O(1) ready notification.

Group B (5 Marks)

Q3[5 marks] · Unit 4: Elementary Socket Calls

Explain socket address structures: sockaddr_in (IPv4) versus sockaddr_in6 (IPv6). How does sockaddr provide generic polymorphism in C?

Show solution

sockaddr defines generic sa_family_t and 14 bytes char; sockaddr_in casts to sockaddr using sin_family, sin_port, sin_addr.

Q4[5 marks] · Unit 7: Socket Options

What are socket options? Explain SO_REUSEADDR, SO_KEEPALIVE, and TCP_NODELAY (Nagle's Algorithm disable).

Show solution

SO_REUSEADDR allows instant server restart on ports in TIME_WAIT. TCP_NODELAY disables Nagle's algorithm for interactive real-time payloads.

Q5[5 marks] · Unit 9: Unix Domain Protocol

Explain Unix Domain Sockets (AF_UNIX). Why are they faster than standard loopback TCP (AF_INET 127.0.0.1)?

Show solution

AF_UNIX bypasses network stack checksumming, IP header generation, and packet segmentation, passing memory buffers directly in kernel space.

BIT401CO

Switch Course

Exam Sections

Other Exam Years

No past exam questions for this topic.

Search BIT401CO

Reading

Theme
Reading mode
Text size
Default
Font
Line width
Line spacing