C: final assessment

This covers the whole course. Take it after the last module.

Final quiz

1. What does printf("%d", 7 / 2) print?
2. What is 10 % 3?
3. Which format reads a long long?
4. Which condition is true exactly when x is from 1 to 9, and false otherwise?
5. What happens when a case in a switch has no break?
6. int a[3] = {1}; what is a[2]?
7. char s[3] = "abc"; what is wrong?
8. How should two strings be compared in C?
9. What does a function's prototype tell the compiler?
10. int x = 3; int *p = &x; int **q = &p; **q = 8; what is x?
11. int a[4]; int *p = a + 3; what is p - a?
12. What is the value of sizeof(char)?
13. After free(p), which is an error?
14. Why might realloc's result be stored in a second pointer first?
15. Which is true of a struct's assignment?
16. Which of these is undefined behaviour?

Practical assessment: Build a word frequency counter

Without using hints, write a program that reads words from a file, counts how many times each appears and prints the results from most to least common.

Final project

A student records system: Build a program that adds, lists, searches and sorts student records, and saves them in a file so that they are still there next time.

How it is evaluated

To complete this course