Skip to content
KALANBLON
Show contents

Chapter 3 of 6 · 10 min

Quiz: files and errors

Files, safe conversions and error handling: let's check that your C programs stand up to the real world. You need 70 % correct answers, and every answer is explained.

Quiz

5 questions · pass mark: 70%

  1. 1.What does fopen return when the file can't be opened?

    One answer

  2. 2.Why write %31s rather than %s to read a word into char city[32]?

    One answer

  3. 3.With strtol(text, &end, 10), which signs show invalid input? (several answers)

    Several answers possible

  4. 4.Complete the function that flushes the write buffer and releases the file.

    Complete the code

    fprintf(f, "%d\n", total);
    ______(f);
  5. 5.What is the label end: for in a function that opens several resources?

    One answer

Your progress is saved on this device. Create a free account to keep your progress on all your devices.