Gate2017 ss Q13

0. Match the following:
P. Static char var;i. Sequence of memory locations to store addresses
Q. m = malloc (10);
m = NULL:
ii. A variable located in data section of memory
R. R. char * ptr [10]iii. Request to allocate a CPU register to store data
S. Register int var1;iv. A lost memory which  cannot be freed

  • Option : A
  • Explanation :
    P. static char var:
    var is defined as character variable whose associated storage class is static because of this it is given memory from data segment
    Q. m malloc(10);
    m = NULL;
    10 contiguous bytes of memory is allocated is address of first byte is stored in 'm' and later it is updated with NULL. Now we lost the address of first bytes of that chunk of memory completely. So we can't free that space as we need the address of first byte to free it up
    R. char * ptr [10]:
    ptr is an array of 10 pointers pointing to character variables.
    S. register int varl:
    Suggesting the complier to store the var1 “value” in CPU register.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *