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

CSE MCQs :: C-MCQs

  1. Members of a union are accessed as________________.
  2. A.
    union-name.member
    B.
    union-pointer->member
    C.
    Both a & b
    D.
    None of the mentioned

  3. Which of the following share a similarity in syntax?
          1. Union, 2. Structure, 3. Arrays and 4. Pointers
  4. A.
    3 and 4
    B.
    1 and 2
    C.
    1 and 3
    D.
    1, 3 and 4

  5. Which of the following data types are accepted while declaring bit-fields?
  6. A.
    char
    B.
    float
    C.
    double
    D.
    None of the mentioned

  7. For what minimum value of x in a 32-bit Linux OS would make the size of s equal to 8 bytes?

    struct temp
    {
    int a : 13;
    int b : 8;
    int c : x;
    }s;
  8. A.
    4
    B.
    8
    C.
    12
    D.
    32

  9. In the declaration of bit-fields,
         struct-declarator:
         declarator
         type-specifier declarator opt : constant-expression
         The constant-expression specifies
  10. A.
    The width of the field in bits.
    B.
    Nothing
    C.
    The width of the field in bytes.
    D.
    Error

  11. Which of the following is not allowed?
  12. A.
    Arrays of bit fields
    B.
    Pointers to bit fields
    C.
    Functions returning bit fields
    D.
    None of the mentioned

  13. Bit fields can only be declared as part of a structure.
  14. A.
    false
    B.
    true
    C.
    Nothing
    D.
    Varies