Home / C Programming / Pointers :: General Questions

C Programming :: Pointers

  1. What is (void*)0?

  2. A.
    Representation of NULL pointer
    B.
    Representation of void pointer
    C.
    Error
    D.
    None of above

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Can you combine the following two statements into one?

    char *p;
    p = (char*) malloc(100); 
    

     

  4. A.

    char p = *malloc(100);

    B.

    char *p = (char) malloc(100);

    C.

    char *p = (char*)malloc(100);

    D.

    char *p = (char *)(malloc*)(100);

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. In which header file is the NULL macro defined?

  6. A.
    stdio.h
    B.
    stddef.h
    C.
    stdio.h and stddef.h
    D.
    math.h

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. How many bytes are occupied by near, far and huge pointers (DOS)?

  8. A.
    near=2 far=4 huge=4
    B.
    near=4 far=8 huge=8
    C.
    near=2 far=4 huge=8
    D.
    near=4 far=4 huge=8

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?

  10. A.
    .
    B.
    &
    C.
    *
    D.
    ->

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What would be the equivalent pointer expression for referring the array element a[i][j][k][l]

  12. A.
    ((((a+i)+j)+k)+l)
    B.
    *(*(*(*(a+i)+j)+k)+l)
    C.
    (((a+i)+j)+k+l)
    D.
    ((a+i)+j+k+l)

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. A pointer is

  14. A.
    A keyword used to create variables
    B.
    A variable that stores address of an instruction
    C.
    A variable that stores address of other variable
    D.
    All of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. In the following program add a statement in the function fact() such that the factorial gets stored in j.

    #include 
    void fact(int*);
    
      int main() 
      {   
         int i=5;    
         fact(&i);    
         printf("%d\n", i);   
         return 0; 
     }
     void fact(int *j)
     {
         static int s=1;  
         if(*j!=0)    
         {        
            s = s**j;     
           *j = *j-1;        
           fact(j);        
          /* Add a statement here */   
      } 
    } 

     

     

  16. A.

    j=s;

    B.

    *j=s;

    C.

    *j=&s;

    D.

    &j=s;

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. The operator used to get value at address stored in a pointer variable is

  18. A.
    *
    B.
    &
    C.
    &&
    D.
    ||

    View Answer

    Workspace

    Discuss Discuss in Forum