logo

CuriousTab

CuriousTab

Structures, Unions, Enums problems


  • 1. A union cannot be nested in a structure

  • Options
  • A. True
  • B. False
  • Discuss
  • 2. Bit fields CANNOT be used in union.

  • Options
  • A. True
  • B. False
  • Discuss
  • 3. one of elements of a structure can be a pointer to the same structure.

  • Options
  • A. True
  • B. False
  • Discuss
  • 4. A structure can contain similar or dissimilar elements

  • Options
  • A. True
  • B. False
  • Discuss
  • 5. It is not possible to create an array of pointer to structures.

  • Options
  • A. True
  • B. False
  • Discuss
  • 6. If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?
    struct ex
    {
        char ch;
        int i;
        long int a;
    };
    

  • Options
  • A. Yes
  • B. No
  • Discuss
  • 7. Can we have an array of bit fields?

  • Options
  • A. Yes
  • B. No
  • Discuss
  • 8. size of union is size of the longest element in the union

  • Options
  • A. Yes
  • B. No
  • Discuss
  • 9. Can a structure can point to itself?

  • Options
  • A. Yes
  • B. No
  • Discuss
  • 10. If the following structure is written to a file using fwrite(), can fread() read it back successfully?
    struct emp
    {
        char *n;
        int age;
    };
    struct emp e={"CuriousTab", 15};
    FILE *fp;
    fwrite(&e, sizeof(e), 1, fp);
    

  • Options
  • A. Yes
  • B. No
  • Discuss

First 2 3 4 5