Structure and Union MCQs
Practice free Structure and Union multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 190 questions — no login required.
Question 64hard
What will be the output of the following C code?
#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
printf("%d", sizeof(s));
}Question 65easy
What is typedef declaration?
Question 66easy
Which of the following is an incorrect syntax for pointer to structure?
(Assuming struct temp{int b;}*my_struct;)Advertisement
Question 67medium
The size of a union is determined by the size of the . . . . . . . .
Question 68hard
What will be the output of the following C code?
#include <stdio.h>
struct p
{
int x;
char y;
};
typedef struct p* q*;
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
q ptr1 = p1;
printf("%d\n", ptr1->x);
}Question 69easy
Which of the following is not possible regarding the structure variable?
Advertisement
Question 70hard
What will be the output of the following C code? (Assuming size of int be 4)
#include <stdio.h>
struct temp
{
int a;
int b;
int c;
} p[] = {0};
main()
{
printf("%d", sizeof(p));
}Question 71hard
What will be the output of the following C code?
#include <stdio.h>
union p
{
int x;
char y;
}k = {1, 97};
int main()
{
printf("%d\n", k.y);
}Question 72hard
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->x);
return 0;
}