logo

CuriousTab

CuriousTab

Discussion


Home C Programming Floating Point Issues See What Others Are Saying!
  • Question
  • What will you do to treat the constant 3.14 as a long double?


  • Options
  • A. use 3.14LD
  • B. use 3.14L
  • C. use 3.14DL
  • D. use 3.14LF

  • Correct Answer
  • use 3.14L 

    Explanation
    Given 3.14 is a double constant.

    To specify 3.14 as long double, we have to add L to the 3.14. (i.e 3.14L)


    More questions

    • 1. What will be the output of the program if value 25 given to scanf()?
      #include<stdio.h>
      
      int main()
      {
          int i;
          printf("%d\n", scanf("%d", &i));
          return 0;
      }
      

    • Options
    • A. 25
    • B. 2
    • C. 1
    • D. 5
    • Discuss
    • 2. In the statement expression1 >> expression2. if expression1 is a signed integer with its leftmost bit set to 1 then on right shifting it the result of the statement will vary from computer to computer

    • Options
    • A. True
    • B. False
    • Discuss
    • 3. What do the following declaration signify?
      int *ptr[30];

    • Options
    • A. ptr is a pointer to an array of 30 integer pointers.
    • B. ptr is a array of 30 pointers to integers.
    • C. ptr is a array of 30 integer pointers.
    • D. ptr is a array 30 pointers.
    • Discuss
    • 4. Range of float id -2.25e+308 to 2.25e+308

    • Options
    • A. True
    • B. False
    • Discuss
    • 5. What will be the output of the program (in Turbo C under DOS)?
      #include<stdio.h>
      
      int main()
      {
          char huge *near *far *ptr1;
          char near *far *huge *ptr2;
          char far *huge *near *ptr3;
          printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3));
          return 0;
      }
      

    • Options
    • A. 4, 4, 8
    • B. 2, 4, 4
    • C. 4, 4, 2
    • D. 2, 4, 8
    • Discuss
    • 6. What will be the output of the program in 16-bit platform (under DOS)?
      #include<stdio.h>
      
      int main()
      {
          struct node
          {
              int data;
              struct node *link;
          };
          struct node *p, *q;
          p = (struct node *) malloc(sizeof(struct node));
          q = (struct node *) malloc(sizeof(struct node));
          printf("%d, %d\n", sizeof(p), sizeof(q));
          return 0;
      }
      

    • Options
    • A. 2, 2
    • B. 8, 8
    • C. 5, 5
    • D. 4, 4
    • Discuss
    • 7. Is it true that too many recursive calls may result into stack overflow?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. The operator used to get value at address stored in a pointer variable is

    • Options
    • A. *
    • B. &
    • C. &&
    • D. ||
    • Discuss
    • 9. If the size of integer is 4bytes, What will be the output of the program?
      #include<stdio.h>
      
      int main()
      {
          int arr[] = {12, 13, 14, 15, 16};
          printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0]));
          return 0;
      }
      

    • Options
    • A. 10, 2, 4
    • B. 20, 4, 4
    • C. 16, 2, 2
    • D. 20, 2, 2
    • Discuss
    • 10. What do the following declaration signify?
      void *cmp();

    • Options
    • A. cmp is a pointer to an void type.
    • B. cmp is a void type pointer variable.
    • C. cmp is a function that return a void pointer.
    • D. cmp function returns nothing.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment