CSSE 132 · Fall 2026–2027

Exam 3 Preparation

Connect networking, sockets, output pointers, and concurrency. Try explaining each idea on paper, then revisit your course work on the Linux VM. Use this guide to choose practice, and follow instructor announcements for final exam instructions.

Exam 3 at a Glance

Time and weighting

Wednesday, November 11, 2026, 1:00–3:50 p.m. The written portion has a 40-minute maximum and is worth 60 points (60%). Coding contributes 40 points (40%).

Instructions

Coding: Review C arrays, loops, pointers, strings, structs, and dynamic memory. Sockets and ARM64 assembly coding are excluded. Start with the Coding Final: Review and Practice, including five short exercises and downloadable starter files.

Allowed resources

For the written portion, you can use a calculator and one two-sided sheet of notes. Other resources and electronic devices are not permitted.

For coding, use SSH to your CSSE132 Linux VM and a terminal editor. You may use your current-term submitted assignments/labs, VM manpages, and the course website and its direct links. Follow the exam instructions for submission.

Resource boundaries: No AI/LLM tools, other Internet sources, messaging, smartphone communication, modern IDEs, or code from another course or prior term. Follow the permitted-function rules in each problem.

What You Should Know

Written topic weights; see the coding review for practical C preparation
TopicWritten pointsSkills to practice
Computer networking10Explain how IP addresses identify hosts/interfaces and ports distinguish services. Describe TCP client/server roles and reliable, ordered byte communication.
Socket programming20Explain socket, bind, listen, accept, connect, send, recv, and close. Trace client/server workflows; distinguish a listening socket from a connected socket. Track buffer capacity, byte counts, null termination, and communication order dictated by the application protocol.
Pointers as output parameters15Trace changes through a pointer versus changes to a copied input. Explain when a pointer-to-pointer lets a helper replace a caller's pointer. Track allocated storage, caller-visible results, ownership, and cleanup.
Threads and mutual exclusion15Interpret pthread_create and pthread_join. Distinguish each invocation's local objects from shared objects. Explain races and lost updates, identify a critical section, and place mutex operations around the complete shared operation.

Quick reference: A descriptor identifies an open socket in a process; a port identifies a network service. A pointer value is an address; dereferencing it accesses an object. Joining waits for completion; a mutex controls access to a shared operation.

What to Review

Worksheet numbers below are the titles printed on the worksheets. Some filenames have different numbers. Review all assigned work beyond Exam 2's coverage, using the earlier assignments below when you need to strengthen the C foundations.

Course resources by topic
TopicWorksheetsHomeworkLabsAdditional reading
Networking20: Computer NetworkNo dedicated networking homework7: Client/ServerNames, addresses, and ports
Socket programming21: Client
23: Server
6 and 7: supporting buffer/string and file practice; not socket assignments7: Client/Server
6: Input and Output (earlier foundation)
Socket clients
Socket servers
Client/server reference
Output pointers24: Pass Pointers for Output5: earlier memory lifetime/ownership foundation; 7: allocated results and file processing6: earlier allocation and input foundationPassing pointers for output
Memory errors and heap ownership
Homework 5 review
Homework 6 review
Threads/mutexes25: Parallel Programming with pthread
26: Race Conditions and Mutual Exclusion
No assigned thread exercise in Homework 7Use Worksheets 25–26 for thread practice; Lab 7 supplies socket backgroundGetting started with threads
Mutual exclusion

Use Course Materials and the schedule for the full resource list.

Practice Your Understanding

  1. Match the concepts: Match host/interface address, service selector, and process-local handle to IP address, port, and socket descriptor. Why would copying a socket descriptor number to a different program not identify a remote service?
  2. Debug a protocol: An image client connects and immediately waits for a reply. Its server waits for a filename before replying. Assume both use blocking calls and the connection succeeds. Why can both wait forever? What agreement would fix this? Which server socket should remain available for accepting a later client?
  3. Trace aliases: In the fragment below, what does the caller's array contain afterward? Does assigning cursor replace the caller's pointer?
    void advance(int *cursor) {
        cursor[1] += cursor[0]; // write through the pointer
        cursor = NULL;        // change the local pointer copy
    }
    /* In a caller: */
    int samples[] = {6, 11, 3};
    int *view = samples;
    advance(view);
    For a different helper that must replace a caller's char *text with new heap storage, what parameter type and call argument are needed? Who must eventually free the result?
  4. Reason about workers: Two workers read different immutable input arrays and write separate result slots in one heap allocation. Main reads both results only after joining both workers. Is every heap access automatically a race? What changes if both workers update the same result slot without synchronization?
  5. Find the critical section: Two workers reserve seats by checking whether a shared seats-remaining value is positive, then reducing it. Why is a mutex around only the reduction insufficient? Explain which actions must use the same lock.
Answers and reasoning
  1. An IP address identifies the host/interface, a port selects a service, and a descriptor is a local handle. Another program's descriptor table does not define the remote endpoint.
  2. Both endpoints are waiting to receive. Agree that the client sends its filename request first and the server replies afterward. Keep the listening socket for future accepts; exchange this client's bytes on its connected socket. TCP preserves byte order but does not preserve send-call boundaries; receiving code must follow the protocol's framing rule.
  3. The array becomes {6, 17, 3}; view still points at its first element. The local cursor assignment does not replace view. A helper replacing text needs char **, called with &text. Its documented ownership contract should give the caller responsibility for freeing the returned allocation once no longer needed.
  4. Shared allocation does not mean every element is concurrently modified. Distinct slots and immutable inputs avoid conflicting accesses here; joining ensures main waits for results. Unsynchronized conflicting updates to one slot cause a data race in C, whose behavior is undefined. Each invocation has its own local variables, but pointers can still refer to shared data.
  5. Both workers could observe the same available seat before either reduces the count. Protect the check and conditional reduction together using the same mutex for every access that participates in that shared operation. Joining later does not protect it.

Common Mistakes

  • IP address versus port: Explain both parts of an endpoint rather than treating them as interchangeable.
  • Listening versus connected sockets: Accept returns a connection for one client; the listener remains available for accepting others.
  • TCP versus messages: One send need not correspond to one recv. Check returned byte counts; follow the application's communication order.
  • Bytes versus strings: recv does not append a null terminator. Reserve space and check for errors or end-of-stream before using received bytes as a C string. For a positive-size TCP receive, zero indicates end-of-stream, not a temporarily empty connection.
  • Pointer copies versus caller storage: Assigning a local pointer and writing through it affect different objects. Returning a local array's address does not extend its lifetime.
  • Join versus exclusion: pthread_join waits for completion. Use a mutex to protect the entire shared check/update operation, including the read.

Exam Preparation Checklist

  • Redo Worksheets 20, 21, and 23–26 without looking at answers; explain each result.
  • Revisit Homework 7 and Lab 7, then use Homework 5/6 and Lab 6 to repair gaps in pointers, allocation, strings, and I/O.
  • Draw client/server timelines, mark who sends first, and label each descriptor's role.
  • Draw caller variables separately from allocated storage; label pointer levels and cleanup responsibility.
  • Explain one possible lost-update interleaving as a simplified model, then explain why an actual C data race has undefined behavior.
  • On your course Linux VM, compile and test your own course exercises. Try small inputs, boundary cases, and failure paths; use GDB to investigate unexpected behavior.