C Programming - Structures, Unions, Enums

1. 

A union cannot be nested in a structure

A. True
B. False

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

2. 

Nested unions are allowed

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

3. 

Bit fields CANNOT be used in union.

A. True
B. False

Answer: Option B

Explanation:

The following is the example program to explain "using bit fields inside an union".

#include<stdio.h>

union Point
{
  unsigned int x:4;
  unsigned int y:4;
  int res;
};

int main()
{
   union  Point pt;

   pt.x = 2;
   pt.y = 3;
   pt.res = pt.y;

   printf("\n The value of res = %d" , pt.res);

   return 0;
}
// Output: The value of res = 3


4. 

one of elements of a structure can be a pointer to the same structure.

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

5. 

A structure can be nested inside another structure.

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.