GATE | GATE-CS-2017 (Set 2) | Question 25

Match the following:

g2017_16
(A) P–>(ii), Q–>(iv), R–>(i), S–>(iii)
(B) P–>(ii), Q–>(i), R–>(iv), S–>(iii)
(C) P–>(ii), Q–>(iv), R–>(iii), S–>(i)
(D) P–>(iii), Q–>(iv), R–>(i), S–>(ii)


Answer: (A)

Explanation:

  • static char var; -> A variable located in data section of memory as it is static in nature
  • m = malloc(10); m = null; ->This is a lost memory which cannot be freed as m=NULL
  • Char *Ptr[10]; -> 10 memory locations of char type are allocated to store addresses
  • register int var1;-> Request to allocate a CPU register to store data

Therefore, Option is A



Refer following articles for details:
https://www.geeksforgeeks.org/memory-layout-of-c-program/
https://www.geeksforgeeks.org/understanding-register-keyword/

Quiz of this Question



My Personal Notes arrow_drop_up