Skip to content
KALANBLON
Show contents

Chapter 7 of 7 · 10 min

Quiz: memory

Pointers, structures, malloc and free: let's check that you keep memory under control. You need 70% correct answers.

Quiz

6 questions · pass mark: 70%

  1. 1.What does this code display?

    One answer

    int a = 10;
    int *p = &a;
    *p = *p + 5;
    printf("%d\n", a);
  2. 2.Which call lets swap(int *a, int *b) swap x and y?

    One answer

  3. 3.Fill in the blank to access the field price through the pointer p.

    Complete the code

    Product *p = &coffee;
    p____price = 9.0;
  4. 4.Which practices are correct with malloc? (several answers)

    Several answers possible

  5. 5.What happens when you use a memory area after freeing it with free?

    One answer

  6. 6.Why write scanf("%31s", name) with char name[32]?

    One answer

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