logo

CuriousTab

CuriousTab

Discussion


Home C Programming C Preprocessor See What Others Are Saying!
  • Question
  • What will be the output of the program?
    #include<stdio.h>
    #define MESS junk
    
    int main()
    {
        printf("MESS\n");
        return 0;
    }
    


  • Options
  • A. junk
  • B. MESS
  • C. Error
  • D. Nothing will print

  • Correct Answer
  • MESS 

    Explanation
    printf("MESS\n"); It prints the text "MESS". There is no macro calling inside the printf statement occured.

    More questions

    • 1. Macros have a local scope.

    • Options
    • A. True
    • B. False
    • Discuss
    • 2. If an unsigned int is 2 bytes wide then, What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          unsigned int a=0xffff;
          ~a;
          printf("%x\n", a);
          return 0;
      }
      

    • Options
    • A. ffff
    • B. 0000
    • C. 00ff
    • D. ddfd
    • Discuss
    • 3. Declare the following statement?
      "A pointer to an array of three chars".

    • Options
    • A.
      char *ptr[3]();
    • B.
      char (*ptr)*[3];
    • C.
      char (*ptr[3])();
    • D.
      char (*ptr)[3];
    • Discuss
    • 4. What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          unsigned int res;
          res = (64 >>(2+1-2)) & (~(1<<2));
          printf("%d\n", res);
          return 0;
      }
      

    • Options
    • A. 32
    • B. 64
    • C. 0
    • D. 128
    • Discuss
    • 5. Union elements can be of different sizes.

    • Options
    • A. True
    • B. False
    • Discuss
    • 6. What will be the output of the program in DOS (Compiler - Turbo C)?
      #include<stdio.h>
      double i;
      
      int main()
      {
          (int)(float)(char) i;
          printf("%d",sizeof(i));
          return 0;
      }
      

    • Options
    • A. 4
    • B. 8
    • C. 16
    • D. 22
    • Discuss
    • 7. size of union is size of the longest element in the union

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. Bitwise & can be used to divide a number by powers of 2

    • Options
    • A. True
    • B. False
    • Discuss
    • 9. Assuming, integer is 2 byte, What will be the output of the program?
      #include;
      
      int main()
      {
          printf("%x\n", -1>>1);
          return 0;
      }
      

    • Options
    • A. ffff
    • B. 0fff
    • C. 0000
    • D. fff0
    • Discuss
    • 10. What is the output of the program given below?
      #include<stdio.h>
      int main()
      {
          enum status { pass, fail, atkt};
          enum status stud1, stud2, stud3;
          stud1 = pass;
          stud2 = atkt;
          stud3 = fail;
          printf("%d, %d, %d\n", stud1, stud2, stud3);
          return 0;
      }
      

    • Options
    • A. 0, 1, 2
    • B. 1, 2, 3
    • C. 0, 2, 1
    • D. 1, 3, 2
    • Discuss


    Comments

    There are no comments.

Enter a new Comment