Home / CSE MCQs / C-MCQs :: c-data-types

CSE MCQs :: C-MCQs

  1. %f access specifier is used for?
  2. A.
    Integer type
    B.
    Character type
    C.
    Floating type
    D.
    None of the above

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Select the odd one out with respect to type?
  4. A.
    char
    B.
    int
    C.
    long
    D.
    float

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        int main()
        {
            float a = 5.477777777777;
            printf("%f", a);
        }
  6. A.
    5.477777
    B.
    5.477778
    C.
    5.478
    D.
    5.48

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of the following % operation is invalid?
  8. A.
    4 % 8;
    B.
    4 % 8l;
    C.
    4 % 8f;
    D.
    Both (b) and (c)

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which data type is suitable for storing a number like?
          10.0000000001
  10. A.
    int
    B.
    float
    C.
    double
    D.
    Both (b) and (c)

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Modulus for float could be achieved by?
  12. A.
    fmod(a, b);
    B.
    modulus(a, b);
    C.
    a % b
    D.
    mod(a, b);

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Predict the data type of the following mathematical operation?
         12 * 7 + 5 / 2 . 0
  14. A.
    int
    B.
    long
    C.
    float
    D.
    double

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. %lf is used to display?
  16. A.
    float
    B.
    long float
    C.
    double
    D.
    int

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What is the output of this C code?

        void main()
        {
            float x = 0.1;
            if (x == 0.1)
                printf("Sanfoundry");
            else
                printf("Advanced C Classes");
        }

  18. A.
    Advanced C Classes
    B.
    Sanfoundry
    C.
    Run time error
    D.
    Compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Comment on the output of this C code?

        void main()
        {
            float x = 0.1;
            printf("%d, ", x);
            printf("%f", x);
        }
  20. A.
    0.100000, junk value
    B.
    junk value, 0.100000
    C.
    0, 0.100000
    D.
    0, 0.999999

    View Answer

    Workspace

    Discuss Discuss in Forum