logo

CuriousTab

CuriousTab

Discussion


Home C Programming Pointers Comments

  • Question
  • 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?


  • Options
  • A. float **fun(float***);
  • B. float *fun(float**);
  • C. float fun(float***);
  • D. float ****fun(float***);

  • Correct Answer
  • float ****fun(float***); 


  • Pointers problems


    Search Results


    • 1. In the following program add a statement in the function fun() such that address of a gets stored in j?
      #include<stdio.h>
      int main()
      {
          int *j;
          void fun(int**);
          fun(&j);
          return 0;
      }
      void fun(int **k)
      {
          int a=10;
          /* Add a statement here */
      }
      

    • Options
    • A. **k=a;
    • B. k=&a;
    • C. *k=&a
    • D. &k=*a
    • Discuss
    • 2. Which statement will you add to the following program to ensure that the program outputs "CuriousTab" on execution?
      #include<stdio.h>
      
      int main()
      {
          char s[] = "CuriousTab";
          char t[25];
          char *ps, *pt;
          ps = s;
          pt = t;
          while(*ps)
              *pt++ = *ps++;
      
          /* Add a statement here */
          printf("%s\n", t);
          return 0;
      }
      

    • Options
    • A. *pt='';
    • B. pt='\0';
    • C. pt='\n';
    • D. *pt='\0';
    • Discuss
    • 3. Which of the statements is correct about the program?
      #include<stdio.h>
      
      int main()
      {
          int arr[3][3] = {1, 2, 3, 4};
          printf("%d\n", *(*(*(arr))));
          return 0;
      }
      

    • Options
    • A. Output: Garbage value
    • B. Output: 1
    • C. Output: 3
    • D. Error: Invalid indirection
    • Discuss
    • 4. Which of the statements is correct about the program?
      #include<stdio.h>
      
      int main()
      {
          float a=3.14;
          char *j;
          j = (char*)&a;
          printf("%d\n", *j);
          return 0;
      }
      

    • Options
    • 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
    • Discuss
    • 5. In the following program add a statement in the function fact() such that the factorial gets stored in j.
      #include<stdio.h>
      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 */
          }
      }
      

    • Options
    • A. j=s;
    • B. *j=s;
    • C. *j=&s;
    • D. &j=s;
    • Discuss
    • 6. Which of the following statements correct about k used in the below statement?
      char ****k;

    • Options
    • 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
    • Discuss
    • 7. Which of the statements is correct about the program?
      #include<stdio.h>
      
      int main()
      {
          int i=10;
          int *j=&i;
          return 0;
      }
      

    • Options
    • A. j and i are pointers to an int
    • B. i is a pointer to an int and stores address of j
    • C. j is a pointer to an int and stores address of i
    • D. j is a pointer to a pointer to an int and stores address of i
    • Discuss
    • 8. What will be the output of the program?
      #include<stdio.h>
      #include<string.h>
      
      int main()
      {
          static char s[] = "Hello!";
          printf("%d\n", *(s+strlen(s)));
          return 0;
      }
      

    • Options
    • A. 8
    • B. 0
    • C. 16
    • D. Error
    • Discuss
    • 9. What will be the output of the program?
      #include<stdio.h>
      #include<string.h>
      
      int main()
      {
          char str1[20] = "Hello", str2[20] = " World";
          printf("%s\n", strcpy(str2, strcat(str1, str2)));
          return 0;
      }
      

    • Options
    • A. Hello
    • B. World
    • C. Hello World
    • D. WorldHello
    • Discuss
    • 10. What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          char str1[] = "Hello";
          char str2[] = "Hello";
          if(str1 == str2)
              printf("Equal\n");
          else
              printf("Unequal\n");
          return 0;
      }
      

    • Options
    • A. Equal
    • B. Unequal
    • C. Error
    • D. None of above
    • Discuss


    Comments

    There are no comments.

Enter a new Comment