31.
Find the output of the following program:
void main()
{
   struct xx
   {
      int x=3;
      char name[]="hello";
   };
   struct xx *s;
   printf("%d", s->x);
   printf("%s", s->name);
}

32.
Consider the following code.
struct account{
   int acno;
}svar, *pv = &svar;

then the acno can be accessed by

33.
Consider the following declarations:
union id
{
   char color;
   int size;
};
struct{
   char country;
   int date;
   union id id;
}flag;

To assign a color to a flag, the correct statement would be

34.
For the following structure declaration, find the correct statement.
struct person{
   char name[20];
   int  age;
   struct person lady;
};

35.
The restriction with union is

36.
How many union members can be initialized?

37.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    typedef struct p *q;
    struct p
    {
        int x;
        char y;
        q ptr;
    };
    struct p p = {1, 2, &p};
    printf("%d\n", p.ptr->x);
    return 0;
}

38.
Can the following C code be compiled successfully?
#include <stdio.h>
struct p
{
    int k;
    char c;
    float f;
};
int main()
{
    struct p x = {.c = 97, .f = 3, .k = 1};
    printf("%f\n", x.f);
}

39.
What will be the output of the following C code?
#include <stdio.h>
int *(*(x()))[2];
typedef int **(*ptrfoo)())[2];
int main()
{
    ptrfoo ptr1;
    ptr1 = x;
    ptr1();
    return 0;
}
int *(*(x()))[2]
{
    int (*ary)[2] = malloc(sizeof * ary);
    return &ary;
}

Read More Section(Structure and Union)

Each Section contains maximum 100 MCQs question on Structure and Union. To get more questions visit other sections.