The most appropriate matching for the following pairs is: X: m = malloc(5); m…

GATE · 2000 · CS · Question 1 subparts

The most appropriate matching for the following pairs is:

X: m = malloc(5); m = NULL; -> 1: using dangling pointers
Y: free(n); n->value = 5; -> 2: using uninitialized pointers
Z: char *p; *p = 'a'; -> 3: lost memory

  1. A.

    X-1, Y-3, Z-2

  2. B.

    X-2, Y-1, Z-3

  3. C.

    X-3, Y-2, Z-1

  4. D.

    X-3, Y-1, Z-2

Attempted by 125 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…