placeholder image to represent content

C programming

Quiz by Smriti Srivastava

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
10 questions
Show answers
  • Q1
    What is the purpose of the 'return' statement in a function in C?
    To loop through code
    To pause the program
    To declare variables
    To exit the function and optionally return a value
    30s
  • Q2
    What does the 'sizeof' operator return in C?
    The number of elements in an array
    The size, in bytes, of a data type or variable
    The memory address of a variable
    The type of a variable
    30s
  • Q3
    In C, what is the correct way to declare a function that takes two integers as parameters and returns their sum as an integer?
    int add(int a)
    int add(int a, int b)
    int add(a, b)
    void add(int a, int b)
    30s
  • Q4
    What function is used to read a string from standard input in C?
    printf
    gets
    fgets
    scanf
    30s
  • Q5
    What will be the output of the following C code: printf("%d", 10 + 20 / 4);?
    20
    30
    10
    15
    30s
  • Q6
    Which operator is used to access members of a structure in C?
    *
    .
    ->
    &
    30s
  • Q7
    What is the correct way to allocate memory dynamically for an array of 10 integers in C?
    int arr[10];
    int *arr = malloc(10);
    int *arr = (int *)calloc(10);
    int *arr = (int *)malloc(10 * sizeof(int));
    30s
  • Q8
    What keyword is used to define a constant value in C?
    constant
    define
    static
    const
    30s
  • Q9
    What will happen if you try to use an uninitialized pointer in C?
    It will point to the stack memory.
    It will always point to the first element of an array.
    It will automatically be initialized to NULL.
    It may lead to undefined behavior.
    30s
  • Q10
    Which function is used to terminate a program in C?
    terminate
    close
    exit
    stop
    30s

Teachers give this quiz to your class