logo

CuriousTab

CuriousTab

Discussion


Home C Programming Declarations and Initializations Comments

  • Question
  • By default a real number is treated as a


  • Options
  • A. float
  • B. double
  • C. long double
  • D. far double

  • Correct Answer
  • double 

    Explanation
    In computing, 'real number' often refers to non-complex floating-point numbers. It include both rational numbers, such as 42 and 3/4, and irrational numbers such as pi = 3.14159265...

    When the accuracy of the floating point number is insufficient, we can use the double to define the number. The double is same as float but with longer precision and takes double space (8 bytes) than float.

    To extend the precision further we can use long double which occupies 10 bytes of memory space.


    Declarations and Initializations problems


    Search Results


    • 1. Identify which of the following are declarations

      1 : extern int x;
      2 : float square ( float x ) { ... }
      3 : double pow(double, double);

    • Options
    • A. 1
    • B. 2
    • C. 1 and 3
    • D. 3
    • Discuss
    • 2. What are the types of linkages?

    • Options
    • A. Internal and External
    • B. External, Internal and None
    • C. External and None
    • D. Internal
    • Discuss
    • 3. How would you round off a value from 1.66 to 2.0?

    • Options
    • A. ceil(1.66)
    • B. floor(1.66)
    • C. roundup(1.66)
    • D. roundto(1.66)
    • Discuss
    • 4. Is the following statement a declaration or definition?
      extern int i;

    • Options
    • A. Declaration
    • B. Definition
    • C. Function
    • D. Error
    • Discuss
    • 5. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?

    • Options
    • A. rem = 3.14 % 2.1;
    • B. rem = modf(3.14, 2.1);
    • C. rem = fmod(3.14, 2.1);
    • D. Remainder cannot be obtain in floating point division.
    • Discuss
    • 6. Which of the following special symbol allowed in a variable name?

    • Options
    • A. * (asterisk)
    • B. | (pipeline)
    • C. - (hyphen)
    • D. _ (underscore)
    • Discuss
    • 7. Which of the following is the correct order if calling functions in the below code?
      a = f1(23, 14) * f2(12/4) + f3();

    • Options
    • A. f1, f2, f3
    • B. f3, f2, f1
    • C. Order may vary from compiler to compiler
    • D. None of above
    • Discuss
    • 8. Which of the following are unary operators in C?

      1. !
      2. sizeof
      3. ~
      4. &&

    • Options
    • A. 1, 2
    • B. 1, 3
    • C. 2, 4
    • D. 1, 2, 3
    • Discuss
    • 9. Which of the following is the correct order of evaluation for the below expression?
      z = x + y * z / 4 % 2 - 1

    • Options
    • A. * / % + - =
    • B. = * / % + -
    • C. / * % - + =
    • D. * % / - + =
    • Discuss
    • 10. Which of the following correctly shows the hierarchy of arithmetic operations in C?

    • Options
    • A. / + * -
    • B. * - / +
    • C. + - / *
    • D. / * + -
    • Discuss


    Comments

    There are no comments.

Enter a new Comment