Skills101
← All practice quizzes

Quiz: C Arrays and Strings

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

Store many values in arrays, use 2D arrays, understand that C strings end with '\0', and use strlen, strcpy, strcat and strcmp safely — with classic programs.

Log in to take the quiz

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

  1. Question 1

    What does this print?

    #include <stdio.h>
    #include <string.h>
    int main(void) {
        char s[] = "hello";
        printf("%zu %zu", strlen(s), sizeof(s));
        return 0;
    }
    
  2. Question 2

    What are the values of int a[5] = {1, 2};?

  3. Question 3

    How should you check if two C strings are equal?

  4. Question 4

    What does this print?

    #include <stdio.h>
    int main(void) {
        int a[] = {5, 10, 15, 20};
        printf("%d", a[1] + a[3]);
        return 0;
    }
    
  5. Question 5

    Why is strcpy dangerous?