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

CSE MCQs :: C-MCQs

  1. What is the output of this C code (on a 32-bit machine)?

        int main()
        {
            int x = 10000;
            double y = 56;
            int *p = &x;
            double *q = &y;
            printf("p and q are %d and %d", sizeof(p), sizeof(q));
            return 0;
        }
  2. A.
    p and q are 4 and 4
    B.
    p and q are 4 and 8
    C.
    Compiler error
    D.
    p and q are 2 and 8

  3. Which is correct with respect to size of the datatypes?
  4. A.
    char > int > float
    B.
    int > char > float
    C.
    char < int < double
    D.
    double > char > int

  5. What is the output of the following C code(on a 64 bit machine)?

        union Sti
        {
            int nu;
            char m;
        };
        int main()

        {
            union Sti s;
            printf("%d", sizeof(s));
            return 0;
        }

  6. A.
    8
    B.
    5
    C.
    9
    D.
    4

  7. What is the output of this C code?

        int main()
        {
            float x = 'a';
            printf("%f", x);
            return 0;
        }
  8. A.
    a
    B.
    run time error
    C.
    a.0000000
    D.
    97.000000

  9. Which of the datatypes have size that is variable?
  10. A.
    int
    B.
    struct
    C.
    float
    D.
    double

  11. The number of digits present after decimal in float is________.
  12. A.
    4
    B.
    1
    C.
    16
    D.
    6

  13. In a 32-bit compiler, which 2 types have same size?
  14. A.
    char and int
    B.
    int and float
    C.
    short and int
    D.
    float and double

  15. What is the size of float in a 32-bit compiler?
  16. A.
    1
    B.
    2
    C.
    4
    D.
    8

  17. Loss in precision occurs for typecasting from____________.
  18. A.
    float to double
    B.
    char to short
    C.
    float to int
    D.
    long to float

  19. For union

        union temp
        {
            char a;
            int b;
            float c;
        };
    The size is decided by:
  20. A.
    char
    B.
    int
    C.
    float
    D.
    Both (b) and (c)