Home / CSE MCQs / C-MCQs :: Structures, Unions, Bit-fields

CSE MCQs :: C-MCQs

  1. Which of the following are themselves a collection of different data types?
  2. A.
    String
    B.
    Structure
    C.
    Char
    D.
    All of the mentioned

  3. User-defined data type can be derived by___________.
  4. A.
    struct
    B.
    enum
    C.
    typedef
    D.
    All of the mentioned

  5. Which operator connects the structure name to its member name?
  6. A.
    -
    B.
    .
    C.
    Both (b) and (c)

  7. Which of the following cannot be a structure member?
  8. A.
    Another structure
    B.
    Function
    C.
    Array
    D.
    None of the mentioned

  9. Which of the following structure declaration will throw an error?
  10. A.
    struct temp{}s;
    main(){}
    B.
    struct temp{};
    struct temp s;
    main(){}
    C.
    struct temp s;
    struct temp{};
    main(){}
    D.
    None of the mentioned

  11. What is the output of this C code?

    void main()
    {
    struct student
    {
    int no;
    char name[20];
    };
    struct student s;
    s.no = 8;
    printf("%d", s.no);
    }
  12. A.
    Nothing
    B.
    Compile time error
    C.
    Junk
    D.
    8

  13. Number of bytes in memory taken by the below structure is?

    struct test
    {
    int k;
    char c;
    };
  14. A.
    Multiple of integer size
    B.
    integer size+character size
    C.
    Depends on the platform
    D.
    Multiple of word size

  15. Size of a union is determined by size of the.
  16. A.
    First member in the union
    B.
    Last member in the union
    C.
    Biggest member in the union
    D.
    Sum of the sizes of all members

  17. Comment on the following union declaration?

    union temp
    {
    int a;
    float b;
    char c;
    };
     union temp s = {1,2.5,'A'}; //REF LINE
         Which member of the union will be active after REF LINE?
  18. A.
    a
    B.
    b
    C.
    c
    D.
    Such declaration are illegal

  19. What would be the size of the following union declaration?

    union uTemp
    {
    double a;
    int b[10];
    char c;
    }u;
    (Assuming size of double = 8, size of int = 4, size of char = 1)
  20. A.
    4
    B.
    8
    C.
    40
    D.
    80