Structure And Union - Study Mode
[#71] What will be the output of the following C code? #include <stdio.h>
union u
{
struct p
{
unsigned char x : 2
unsigned int y : 2
}
int x
}
int main()
{
union u u
u.p.x = 2
printf("%d
", u.p.x)
}
Correct Answer
(A) Compile time error
[#72] Which of the given option is the correct method for initialization? typedef char *string
Correct Answer
(B) string p = "Hello"
[#73] What will be the output of the following C code? #include <stdio.h>
union p
{
int x
char y
}k = {1, 97}
int main()
{
printf("%d
", k.y)
}
Correct Answer
(D) 1
[#74] What will be the output of the following C code? #include <stdio.h>
typedef struct p *q
struct p
{
int x
char y
q ptr
}
int main()
{
struct p p = {1, 2, &p}
printf("%d
", p.ptr->x)
return 0
}
Correct Answer
(B) 1
[#75] Which of the following may create problem in the typedef program?
Correct Answer
(C) All of the mentioned