C-Structure & Union Question and Answer

C-Structure & Union Question and Answer
51. A union can be a member of
  • Structure
  • Array
  • Both a and B
  • None of these
Show Answer
52. Find the correct output
void main ( )
{
struct emp
{
int eid;
char ename[20];
};
struct emp e={010, "Deepak"};
show (e);
}
show (struct {int eid; char ename [20];}e)
{
printf("%0%s", e.eid,e.ename);
}
  • 010
  • 010 Deepak
  • None of these
  • Compilation Error
Show Answer
53. The minimum and maximum range of Bit field is
  • 0 to 15
  • 1 to 16
  • 0 to 31
  • 1 to 32
Show Answer
54. Find the output
void main ( )
{
struct abc
{
char ch[10];
int i;
};
struct abc a=
{"Dear", 10, "Customer", 20};
printf('%s", a.ch);
}

  • Dear
  • Customer
  • Compilation error
  • None of these
Show Answer
55. In the following program p.a. is same as:
struct xxx
{
int a;
int b;
}b={9, 10};

  • p->a
  • &p->a
  • (&p)->a
  • *p.a
Show Answer
56. Find the output
void main ( )
{
struct yyy
{
char ch;
int i;
};
struct yyy y={'1', 1};
xxx (y);
}
xxx (struct yyy y)
{
printf ("%c....%d",y.ch, y.i);
}

  • No output
  • Compilation error
  • 1.....1
  • None of these
Show Answer
57. Find the output
void main ()
{
struct zzz
{
int i;
int j;
}pqr;
struct zzz *z;
z=&pqr;
z->=100
z->=200;
xxx (z);
}
xxx (int *p)
{
p++;
printf("%d", *p);
}

  • 100
  • 200
  • Compilation error
  • None of these
Show Answer
58. Find the output
struct xxx
{
int age;
char name [10];
};
void main ( )
{
struct xxx *p={26, "raja"};
printf('%s", p->name);
}

  • raja
  • Garbage
  • Null pointer assignment
  • Compiltion error
Show Answer
59. Find the output
union complex
{
int i;
float real;
};
void main( )
{
union complex c={2};
printf ("%d %f", c.i,c.real);
}

  • 2 2.000
  • 2 0
  • 2 0.0000
  • Garbage value
Show Answer
60. Find the output
struct str
{
int i;
float f;
};
union uti
{
int i;
float f;
};
void main ( )
{
printf("%d", sizeof (struct str) - sizeof (union uti));
}


  • Error: Structure and union variable are not declared
  • Error: Same members are not declared for both structure and union.
  • 2
  • 0
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test