61. In the following C code, we can access the 1st character of the string sval by using . . . . . .
#include <stdio.h>
struct
{
char *name;
union
{
char *sval;
} u;
} symtab[10];
. .
#include <stdio.h>
struct
{
char *name;
union
{
char *sval;
} u;
} symtab[10];
. .62. What will be the output of the following C code?
#include <stdio.h>
struct point
{
int x;
int y;
};
struct notpoint
{
int x;
int y;
};
int main()
{
struct point p = {1};
struct notpoint p1 = p;
printf("%d\n", p1.x);
}
#include <stdio.h>
struct point
{
int x;
int y;
};
struct notpoint
{
int x;
int y;
};
int main()
{
struct point p = {1};
struct notpoint p1 = p;
printf("%d\n", p1.x);
}
63. What will be the output of the following C code?
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
s->c = "hello";
printf("%s", m.c);
}
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
s->c = "hello";
printf("%s", m.c);
}
64. 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));
}
#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
printf("%d", sizeof(s));
}
65. What is typedef declaration?
66. Which of the following is an incorrect syntax for pointer to structure?
(Assuming struct temp{int b;}*my_struct;)
(Assuming struct temp{int b;}*my_struct;)
67. The size of a union is determined by the size of the . . . . . . . .
68. 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);
}
#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);
}
69. Which of the following is not possible regarding the structure variable?
70. 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));
}
#include <stdio.h>
struct temp
{
int a;
int b;
int c;
} p[] = {0};
main()
{
printf("%d", sizeof(p));
}
Read More Section(Structure and Union)
Each Section contains maximum 100 MCQs question on Structure and Union. To get more questions visit other sections.