42.
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    int no;
    char name[20];
};
void main()
{
    student s;
    s.no = 8;
    printf("hello");
}

44.
What will be the output of the following C code?
#include <stdio.h>
struct point
{
    int x;
    int y;
};
void foo(struct point*);
int main()
{
    struct point p1[] = {1, 2, 3, 4, 5};
    foo(p1);
}
void foo(struct point p[])
{
    printf("%d %d\n", p->x, (p + 2).y);
}

45.
What will be the output of the following C code?
#include <stdio.h>
typedef struct student
{
    char *a;
}stu;
void main()
{
    struct student s;
    s.a = "hey";
    printf("%s", s.a);
}

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

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

48.
What will be the output of the following C code?
#include <stdio.h>
union u
{
    struct
    {
        unsigned char x : 2;
        unsigned int y : 2;
    }p;
    int x;
};
int main()
{
    union u u.p.x = 2;
    printf("%d\n", u.p.x);
}

49.
What will be the output of the following C code?
#include <stdio.h>
struct p
{
    unsigned int x : 7;
    unsigned int y : 2;
};
int main()
{
    struct p p;
    p.x = 110;
    p.y = 2;
    printf("%d\n", p.x);
}

Read More Section(Structure and Union)

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