Skills101
← All practice quizzes

Quiz: Files and Preprocessor

5 questionsNo time limitPass: 60%+10 XP on first pass

Read and write files with fopen, fprintf, fscanf and fgets, check for errors, use command-line arguments, and master the preprocessor: #define, macros, #include and header guards.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does fopen return if the file can't be opened?

  2. Question 2

    What does this print?

    #include <stdio.h>
    #define DOUBLE(x) x + x
    int main(void) {
        printf("%d", DOUBLE(3) * 2);
        return 0;
    }
    
  3. Question 3

    Which mode adds data to the end of an existing file?

  4. Question 4

    What is the purpose of a header guard (#ifndef … #define … #endif)?

  5. Question 5

    When does the preprocessor run?