logo

CuriousTab

CuriousTab

Discussion


Home C Programming Structures, Unions, Enums See What Others Are Saying!
  • Question
  • Is there easy way to print enumeration values symbolically?


  • Options
  • A. Yes
  • B. No

  • Correct Answer
  • No 

    Explanation
    You can write a function of your own to map an enumeration constant to a string.

  • More questions

    • 1. Which of the following statements are correct about the program?
      #include<stdio.h>
      int main()
      {
          int x = 30, y = 40;
          if(x == y)
              printf("x is equal to y\n");
      
          else if(x > y)
              printf("x is greater than y\n");
      
          else if(x < y)
              printf("x is less than y\n")
          return 0;
      }
      

    • Options
    • A. Error: Statement missing
    • B. Error: Expression syntax
    • C. Error: Lvalue required
    • D. Error: Rvalue required
    • Discuss
    • 2. What will be the output of the program?
      #define P printf("%d\n", -1^~0);
      #define M(P) int main()\
                   {\
                      P\
                      return 0;\
                   }
      M(P)
      

    • Options
    • A. 1
    • B. 0
    • C. -1
    • D. 2
    • Discuss
    • 3. Can the fixed arguments passed to the function that accepts variable argument list, occur at the end?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 4. Maximum number of arguments that a function can take is 12

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 5. Is there easy way to print enumeration values symbolically?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 6. Point out the error, if any in the program.
      #include<stdio.h>
      int main()
      {
          int i = 1;
          switch(i)
          {
              printf("This is c program.");
              case 1:
                  printf("Case1");
                  break;
              case 2:
                  printf("Case2");
                  break;
          }
      return 0;
      }
      

    • Options
    • A. Error: No default specified
    • B. Error: Invalid printf statement after switch statement
    • C. No Error and prints "Case1"
    • D. None of above
    • Discuss
    • 7. Can we pass a variable argument list to a function at run-time?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. Which statement will you add in the following program to work it correctly?
      #include<stdio.h>
      int main()
      {
          printf("%f\n", log(36.0));
          return 0;
      }
      

    • Options
    • A. #include<conio.h>
    • B. #include<math.h>
    • C. #include<stdlib.h>
    • D. #include<dos.h>
    • Discuss
    • 9. The macro va_start is used to initialise a pointer to the beginning of the list of fixed arguments.

    • Options
    • A. True
    • B. False
    • Discuss
    • 10. What will be the output of the program (16-bit platform)?
      #include<stdio.h>
      #include<stdlib.h>
      
      int main()
      {
          int *p;
          p = (int *)malloc(20);
          printf("%d\n", sizeof(p));
          free(p);
          return 0;
      }
      

    • Options
    • A. 4
    • B. 2
    • C. 8
    • D. Garbage value
    • Discuss


    Comments

    There are no comments.

Enter a new Comment