91. 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;
struct student *m = &s;
printf("%d", sizeof(student));
}
#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
struct student *m = &s;
printf("%d", sizeof(student));
}
92. What will be the output of the following C code?
#include <stdio.h>
int (*(x()))[2];
typedef int (*(*ptr)())[2] ptrfoo;
int main()
{
ptrfoo ptr1;
ptr1 = x;
ptr1();
return 0;
}
int (*(x()))[2]
{
int (*ary)[2] = malloc(sizeof*ary);
return &ary;
}
#include <stdio.h>
int (*(x()))[2];
typedef int (*(*ptr)())[2] ptrfoo;
int main()
{
ptrfoo ptr1;
ptr1 = x;
ptr1();
return 0;
}
int (*(x()))[2]
{
int (*ary)[2] = malloc(sizeof*ary);
return &ary;
}
93. What will be the output of the following C code?
#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1 = {1, 2};
foo(&p1);
}
void foo(struct point *p)
{
printf("%d\n", *p->x++);
}
#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1 = {1, 2};
foo(&p1);
}
void foo(struct point *p)
{
printf("%d\n", *p->x++);
}
94. 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;
s.c = "hello";
printf("%s", s.c);
}
#include <stdio.h>
struct student
{
char *c;
struct student point;
};
void main()
{
struct student s;
s.c = "hello";
printf("%s", s.c);
}
95. What will be the output of the following C code?
#include <stdio.h>
struct p
{
unsigned int x : 1;
unsigned int y : 1;
};
int main()
{
struct p p;
p.x = 1;
p.y = 2;
printf("%d\n", p.y);
}
#include <stdio.h>
struct p
{
unsigned int x : 1;
unsigned int y : 1;
};
int main()
{
struct p p;
p.x = 1;
p.y = 2;
printf("%d\n", p.y);
}
96. Members of a union are accessed as . . . . . . . .
97. Which option should be selected to work the following C expression?
string p = "HELLO";
string p = "HELLO";
98. 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, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 5);
if (x == 3)
printf("%d %d\n", ptr1->x, (ptr1 + x - 1)->x);
else
printf("false\n");
}
#include <stdio.h>
struct p
{
int x;
int y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 5);
if (x == 3)
printf("%d %d\n", ptr1->x, (ptr1 + x - 1)->x);
else
printf("false\n");
}
99. Which of the following data types are accepted while declaring bit-fields?
100. What will be the output of the following C code?
#include <stdio.h>
struct student
{
char *name;
};
struct student fun(void)
{
struct student s;
s.name = "alan";
return s;
}
void main()
{
struct student m = fun();
s.name = "turing";
printf("%s", m.name);
}
#include <stdio.h>
struct student
{
char *name;
};
struct student fun(void)
{
struct student s;
s.name = "alan";
return s;
}
void main()
{
struct student m = fun();
s.name = "turing";
printf("%s", m.name);
}
Read More Section(Structure and Union)
Each Section contains maximum 100 MCQs question on Structure and Union. To get more questions visit other sections.