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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?
     (7 and 8 are entered)

        void main()
        {
            float x;
            int y;
            printf("enter two numbers \n", x);
            scanf("%f %f", &x, &y);
            printf("%f, %d", x, y);
        }
  2. A.
    7.000000, 7
    B.
    Run time error
    C.
    7.000000, Junk
    D.
    Varies

  3. What is the output of this C code?

        void main()
        {
            double x = 123828749.66;
            int y = x;
            printf("%d\n", y);
            printf("%lf\n", y);
        }

  4. A.
    0, 0.0
    B.
    123828749, 123828749.66
    C.
    12382874, 12382874.0
    D.
    123828749, 0.000000

  5. What is the output of this C code?

        void main()
        {
            int x = 97;
            char y = x;
            printf("%c\n", y);
        }

  6. A.
    a
    B.
    b
    C.
    97
    D.
    Run time error

  7. When double is converted to float, the value is?
  8. A.
    Truncated
    B.
    Rounded
    C.
    Depends on the compiler
    D.
    Depends on the standard

  9. What is the output of this C code?

        int main()
        {
            unsigned int i = 23;
            signed char c = -23;
            if (i > c)
                printf("Yes\n");
            else if (i < c)
                printf("No\n");
        }
  10. A.
    Yes
    B.
    No
    C.
    Depends on the compiler
    D.
    Depends on the operating system

  11. What is the output of this C code?

       int main()
        {
            int i = 23;
            char c = -23;
            if (i < c)
                printf("Yes\n");
            else
                printf("No\n");
        }

  12. A.
    Yes
    B.
    No
    C.
    Depends on the compiler
    D.
    Depends on the standard

  13. function tolower(c) defined in library works for?
  14. A.
    Ascii character set
    B.
    Unicode character set
    C.
    Ascii and utf-8 but not EBSIDIC character set
    D.
    Any character set

  15. What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes?

        int main()
        {
            short int i = 20;
            char c = 97;
            printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
            return 0;
        }
  16. A.
    2, 1, 2
    B.
    2, 1, 1
    C.
    2, 1, 4
    D.
    2, 2, 8

  17. Which type conversion is NOT accepted?
  18. A.
    From char to int
    B.
    From float to char pointer
    C.
    From negative int to char
    D.
    From double to char

  19. What will be the data type of the result of the following operation?
     (float)a * (int)b / (long)c * (double)d
  20. A.
    int
    B.
    long
    C.
    float
    D.
    double