71.
What will be the output of the following C code?
#include <stdio.h>
struct p
{
    int x;
    char y;
};
int main()
{
    struct p p1[] = {1, 92, 3, 94, 5, 96};
    struct p *ptr1 = p1;
    int x = (sizeof(p1) / 3);
    if (x == sizeof(int) + sizeof(char))
        printf("%d\n", ptr1->x);
    else
        printf("falsen");
}

72.
Which of the following will stop the loop at the last node of a linked list in the following C code snippet?
struct node
{
    struct node *next;
};

while (p != NULL)
{
    p = p->next;
}

while (p->next != NULL)
{
    p = p->next;
}

while (1)
{
    p = p->next;
    if (p == NULL)
        break;
}

73.
In the following declaration of bit-fields, the constant-expression must be . . . . . . . .
struct-declarator:
declarator
type-specifier declarator opt : constant-expression

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

75.
What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)
#include <stdio.h>
union uTemp
{
    double a;
    int b[10];
    char c;
}u;

76.
What will be the output of the following C code?
#include <stdio.h>
union p
{
    int x;
    float y;
};
int main()
{
    union p p, b;
    p.x = 10;
    printf("%f\n", p.y);
}

77.
What will be the output of the following C code?
#include <stdio.h>
struct student fun(void)
{
    struct student
    {
        char *name;
    };
    struct student s;
    s.name = "alan";
    return s;
}
void main()
{
    struct student m = fun();
    printf("%s", m.name);
}

78.
In what situation, install function returns NULL?

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

80.
What will be the output of the following C code according to C99 standard?
#include <stdio.h>
struct p
{
    int k;
    char c;
    float f;
};
int main()
{
    struct p x = {.c = 97};
    printf("%f\n", x.f);
}

Read More Section(Structure and Union)

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