¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

C data types: unions, bit fields and enums

saisuhruth 5 preguntas

Hacer el test

Este test tiene tiempo límite, así que se abre en el reproductor de siempre.

Preguntas del test (5)

  1. 1What will be the output of the program ?
    #include<stdio.h>

    int main()
    {
    union var
    {
    int a, b;
    };
    union var v;
    v.a=10;
    v.b=20;
    printf("%d\n", v.a);
    return 0;
    }
    1. A10
    2. B20
    3. C30
    4. D0
  2. 2What will be the output of the program ?
    #include<stdio.h>

    int main()
    {
    struct value
    {
    int bit1:1;
    int bit3:4;
    int bit4:4;
    }bit={1, 2, 13};

    printf("%d, %d, %d\n", bit.bit1, bit.bit3, bit.bit4);
    return 0;
    }
    1. A-1, 2, -3
    2. B1, 2, 3
    3. C1, 4, 4
    4. D-1, -2, -13
  3. 3What will be the output of the program in 16 bit platform (Turbo C under DOS) ?
    #include<stdio.h>

    int main()
    {
    struct value
    {
    int bit1:1;
    int bit3:4;
    int bit4:4;
    }bit;
    printf("%d\n", sizeof(bit));
    return 0;
    }
    1. A1
    2. B2
    3. C4
    4. D9
  4. 4What will be the output of the program ?
    #include<stdio.h>

    int main()
    {
    enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
    printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT);
    return 0;
    }
    1. A-1, 0, 6, 7, 8, 9
    2. B-1, 0, 1, 2, 3, 4
    3. C-1, 2, 6, 3, 4, 5
    4. D-1, 0, 6, 2, 3, 4
  5. 5What will be the output of the program ?
    #include<stdio.h>

    int main()
    {
    enum status {pass, fail, absent};
    enum status stud1, stud2, stud3;
    stud1 = pass;
    stud2 = absent;
    stud3 = fail;
    printf("%d %d %d\n", stud1, stud2, stud3);
    return 0;
    }
    1. A0, 2, 1
    2. B0, 1, 2
    3. C1, 2, 3
    4. D1, 3, 2

Información

Descripción
Test sobre Sin título, creado por saisuhruth el 26/01/2016.
Idioma
English
Visitas
0
Valoración
Aún sin valoraciones
Valora este test
Valora este test

Más sobre Data Types, Variables and Operators

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?