Structure & Union Questions and Answers
Practice ModeShowing 10 of 95 questions
Q21
State the true statement.
Answer: Option C
Q22
Find the output.
typedef struct bitfield
{
int a:3;
char b:7;
unsigned int c:12;
}bit;
void main ( )
{
bit b1;
printf"%d", sizeof(b1));
}
Answer: Option C
Q23
Find the output.
struct bits
{
unsigned int a:3;
};
void main ( )
{
struct bits b={8}'
printf ("5d", b.a);
}
Answer: Option C
Q24
Find the output
struct student
{
char nm[10];
int roll;
};
void main ( )
{
struct student *s,p={raja", 5}'
s=&p;
printf("%d %s", *s.nm,*s.roll);
}
Answer: Option D
Q25
Structure is used for
Answer: Option D
Q26
All structure variables are created in
Answer: Option D
Q27
Find the output
struct st
{
char *name;
int age;
int (*p) ( );
};
void main ( )
{
struct st s={"raja", 10};
s.p=show (&s);
}
show (struct st *s)
{
printf('%s", ++s->name);
}
Answer: Option B
Q28
Can members of a union be same as that of structure member if union is nested withing that structure ?
Answer: Option A
Q29
Find the output
struct x
{
char *x;
};
void main ( )
{
struct x x={"rama"};
printf("%s", x.x);
}
Answer: Option A
Q30
Find the output
struct main {
int n;
int (*p) ( );
};
void main ( )
{
struct main m;
int fun( );
m.p=fun;
* (m.p) ( );
}
fun ( )
{
printf("Hello");
}
Answer: Option D