Skip to main content

Module Quiz

Complete this quiz after finishing all concept and practice pages. Save your answers before opening separate quiz calibration.

Current Module Questions​

Question 1: The Translation Pipeline​

Name the four stages of C translation invoked by gcc hello.c -o hello. For each, name one kind of error that can occur only at that stage.

Question 2: Integer Promotion​

Given unsigned char a = 200, b = 100;, what does printf("%d\n", a + b); print and why?

Question 3: Undefined Behavior vs Unsigned Wrap​

Classify each as defined, implementation-defined, or undefined:

  • (a) unsigned u = UINT_MAX; u = u + 1;
  • (b) int i = INT_MAX; i = i + 1;
  • (c) signed char c = 127; c = c + 1;

Question 4: Sequence Points​

Is int i = 0; int x = i++ + i++; defined in C11? Explain.

Question 5: Array Decay​

Inside void f(int a[10]), sizeof a yields what value, and why is it not 10 * sizeof(int)?

Question 6: Header vs Source​

Which of the following belong in foo.h and which in foo.c? Justify each.

  • (a) int global_counter;
  • (b) extern int global_counter;
  • (c) static int helper(int x) { return x * 2; }
  • (d) int add(int a, int b);
  • (e) int add(int a, int b) { return a + b; }

Question 7: strncpy Trap​

Explain why char dst[5]; strncpy(dst, "hello", 5); puts(dst); is unsafe.

Question 8: gets Removal​

Why was gets removed from C11, and what is the minimum safe replacement?

Question 9: Static at Block Scope​

What is the difference between int counter(void) { int n = 0; return ++n; } and int counter(void) { static int n = 0; return ++n; }?

Question 10: Macro Hazards​

Given #define MAX(a, b) ((a) > (b) ? (a) : (b)), why is MAX(i++, j++) still dangerous?

Question 11: Format String Mismatch​

Classify and rank the severity:

  • (a) printf("%d\n", 3.14);
  • (b) printf("%ld\n", 5); where 5 is an int
  • (c) printf(user_input);

Question 12: Struct Padding​

Why is sizeof(struct { char c; int i; }) often 8 rather than 5?

Question 13: Opaque Types​

What does it mean for List to be an opaque type in a header, and what does it force callers to do?

Question 14: make Basics​

Given a four-line Makefile with a target app: main.o util.o, explain why a make run after editing only util.c does not rebuild main.o.

Question 15: -Wall -Wextra -std=c11​

Name at least three classes of bug that gcc -Wall -Wextra -std=c11 catches that a bare gcc does not.

Interleaved Review Questions​

Prior Module Question 1 (S2 Module 1 - Algorithm Analysis)​

Given T(n) = 2T(n/2) + n, classify the asymptotic growth of T(n) and say which design paradigm commonly produces this recurrence.

Prior Module Question 2 (S3 Design - Design Principles)​

What is the single-responsibility principle, and why does it also apply to a C module with a .h/.c pair?

Prior Module Question 3 (S1 Module 2 - Counting and Proof)​

Why is a proof by examples not enough for a universal claim?

Prior Module Question 4 (S1 Module 3 - Probability)​

What does the law of large numbers say about sample averages, and why is it relevant for stress-testing a C implementation against a random input generator?

Prior Module Question 5 (S2 Module 1 - Correctness)​

State a loop invariant for for (size_t i = 0; i < n; i++) s += a[i];.

Self-Assessment and Remediation​

Mastery Level (90-100% correct):

  • Advance with confidence; keep spaced repetition on translation pipeline and array decay.

Proficient Level (75-89% correct):

  • Review the concept page behind each missed answer and redo two drills from the matching practice page.

Developing Level (60-74% correct):

  • Rework Practice 1 and Practice 2 end-to-end. Redo Kata 3 and Kata 6.
  • If most misses are in strings or I/O, focus on Practice 3.

Insufficient Level (<60% correct):

  • Return to the concept sequence Clusters 1-3 and rebuild the mental model before touching Clusters 4-5 again.
  • Rerun gcc -E, gcc -S, gcc -c, nm, and make by hand on your own tiny project until the pipeline is second nature.

Quiz scores are formative. All CI1–CI6 must pass before claiming input-contract readiness.

Progression boundary​

Quiz performance calibrates retrieval and reasoning. It does not replace runnable work, changed-case transfer, the module assessment or required semester evidence. Consult practice calibration for the additional independent cases.