logo

CuriousTab

CuriousTab

Discussion


Home C Programming Constants See What Others Are Saying!
  • Question
  • What will be the output of the program?
    #include<stdio.h>
    int fun(int **ptr);
    
    int main()
    {
        int i=10;
        const int *ptr = &i;
        fun(&ptr);
        return 0;
    }
    int fun(int **ptr)
    {
        int j = 223;
        int *temp = &j;
        printf("Before changing ptr = %5x\n", *ptr);
        const *ptr = temp;
        printf("After changing ptr = %5x\n", *ptr);
        return 0;
    }
    


  • Options
  • A. Address of i
    Address of j
  • B. 10
    223
  • C. Error: cannot convert parameter 1 from 'const int **' to 'int **'
  • D. Garbage value

  • Correct Answer
  • Error: cannot convert parameter 1 from 'const int **' to 'int **


  • More questions

    • 1. A function that receives variable number of arguments should use va_arg() to extract the last argument from the variable argument list.

    • Options
    • A. True
    • B. False
    • Discuss
    • 2. Bitwise & can be used to check if more than one bit in a number is on.

    • Options
    • A. True
    • B. False
    • Discuss
    • 3. The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces.

    • Options
    • A. True
    • B. False
    • Discuss
    • 4. It is necessary that a header files should have a .h extension?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 5. Bitwise | can be used to set multiple bits in number.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 6. Bitwise & can be used to check if a bit in number is set or not.

    • Options
    • A. True
    • B. False
    • Discuss
    • 7. A pointer union CANNOT be created

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. What will be the output of the program?
      #include<stdio.h>
      #include<stdlib.h>
      
      int main()
      {
          union test
          {
              int i;
              float f;
              char c;
          };
          union test *t;
          t = (union test *)malloc(sizeof(union test));
          t->f = 10.10f;
          printf("%f", t->f);
          return 0;
      }
      

    • Options
    • A. 10
    • B. Garbage value
    • C. 10.100000
    • D. Error
    • Discuss
    • 9. What will be the output of the program?
      #include<stdio.h>
      int main()
      {
          int x=4, y, z;
          y = --x;
          z = x--;
          printf("%d, %d, %d\n", x, y, z);
          return 0;
      }
      

    • Options
    • A. 4, 3, 3
    • B. 4, 3, 2
    • C. 3, 3, 2
    • D. 2, 3, 3
    • Discuss
    • 10. Functions cannot return a floating point number

    • Options
    • A. Yes
    • B. No
    • Discuss


    Comments

    There are no comments.

Enter a new Comment