Home / C Programming / Pointers :: Point Out Correct Statements

C Programming :: Pointers

  1. Which of the following statements correctly declare a function that receives a pointer to pointer to a pointer to a float and returns a pointer to a pointer to a pointer to a pointer to a float?

  2. A.
    float **fun(float***);
    B.
    float *fun(float**);
    C.
    float fun(float***);
    D.
    float ****fun(float***);

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Point out the compile time error in the program given below.

    #include stdio.h 
    
    int  main() {
    
       int *x;
    
       *x=100;
       return 0;
    
    }
    

  4. A.

    Error: invalid assignment for x

    B.

    Error: suspicious pointer conversion

    C.

    No error

    D.

    None of above

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Which of the statements is correct about the program?

     #include
      int main()
      {    
         float a=3.14;  
         char *j;     
         j = (char*)&a;    
         printf("%d\n", *j);    
         return 0;
     } 
    

  6. A.

    It prints ASCII value of the binary number present in the first byte of a float variable a.

    B.

    It prints character equivalent of the binary number present in the first byte of a float variable a.

    C.

    It will print 3

    D.

    It will print a garbage value

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. In the following program add a statement in the function fun() such that address of a gets stored in j?

    #include
     int main() 
     {    
         int *j;   
         void fun(int**);    
         fun(&j);
         return 0;
     } 
     void fun(int **k)
     {     
         int a=10;  
        /* Add a statement here */ 
     } 
    

     

  8. A.

    **k=a;

    B.

    k=&a;

    C.

    *k=&a

    D.

    &k=*a

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which of the following statements correct about k used in the below statement?
    char ****k;

  10. A.
    k is a pointer to a pointer to a pointer to a char
    B.
    k is a pointer to a pointer to a pointer to a pointer to a char
    C.
    k is a pointer to a char pointer
    D.
    k is a pointer to a pointer to a char

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of the statements is correct about the program?

    #include 
     int main() 
     {    
         int arr[3][3] = {1, 2, 3, 4};     
         printf("%d\n", *(*(*(arr))));     
         return 0; 
     } 
    

  12. A.

    Output: Garbage value

    B.

    Output: 1

    C.

    Output: 3

    D.

    Error: Invalid indirection

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Which statement will you add to the following program to ensure that the program outputs "FRESHERGATE" on execution?

    #include 
     int main() 
     {
         char s[] = "FRESHERGATE"; 
         char t[25];   
         char *ps, *pt;    
         ps = s;     
         pt = t;     
         while(*ps)     
             *pt++ = *ps++;
         
     /* Add a statement here */       
        printf("%s\n", t);
        return 0;
     } 
    

  14. A.

    *pt='';

    B.

    pt='\0';

    C.

    pt='\n';

    D.

    *pt='\0';

    View Answer

    Workspace

    Discuss Discuss in Forum