Structure & Union Questions and Answers
Practice ModeShowing 10 of 95 questions
Q31
Find the output
struct kkk
{
char a:4;
char b:4;
char c:1;
int e:2:
};
struct kkk k,s={16, 16, 1, 4};
void main ( )
{
k =s;
printf ("%d %d", k.a, k.c);
}
Answer: Option C
Q32
Find the output
#defne int char
#define char int
struct student
{
char name [10];
int roll;
};
void main ( )
{
struct student s;
printf("%d", sizeof (s);
}
Answer: Option A
Q33
Find the output
struct x
{
char y;
int x;
};
void main ( )
{
struct xx s={'a', 15};
switch (s)
{
case 'a':
printf("Allowed");
break;
case 15:
printf("Not allowed");
break;
default:
printf ("No");
}
}
Answer: Option D
Q34
Find the correct output
#incoude "stdio.h"
void main ( )
{
printf("%d", stdin->bsize);
}
Answer: Option B
Q35
Find the output
struct xyz
{
int x;
char y[5];
};
void main ( )
{
struct xyz m;
m.x=10;
m.y="raja";
printf("%d %s", m.x, m.y);
}
Answer: Option C
Q36
What is the output of the following program if you press 'z' then 'a' in keyboard
void main ( )
{
char ch;
while ((ch=getche( ))==="z");
printf("%c", ch);
}
Answer: Option D
Q37
State the true statement.
Answer: Option C
Q38
Find the correct output
void main
{
struct xxx
{
char c[10]='CITE";
int i=2001;
};
struct xxx a;
printf('%s', a.c);
}
Answer: Option C
Q39
Find the output
struct student
{
int roll;
char name [10];
char city [10];
};
struct student s={10,"milan","puri"}*p;
void main ( )
{
p=*s;
p->roll=20;
p->name=s.city;
printf("%d %s %s", s.roll, s.name, p->city);
}
Answer: Option D
Q40
Which of the following is limitation of bit filed?
Answer: Option D