Structure And Union - Study Mode

[#126] What will be the output of the following C code? #include <stdio.h>
struct p
{
int k
char c
float f
}
int p = 10
int main()
{
struct p x = {1, 97}
printf("%f %d
", x.f, p)
}
Correct Answer

(B) 0.000000 10

[#127] Which of the following structure declaration will throw an error?
Correct Answer

(D) None of the mentioned

[#128] What will be the output of the following C code? #include <stdio.h>
union u
{
struct
{
unsigned char x : 2
unsigned int y : 2
}p
int x
}
int main()
{
union u u
u.p.x = 2
printf("%d
", u.p.x)
}
Correct Answer

(B) 2

[#129] What will be the output of the following C code? #include <stdio.h>
struct student
{
int no
char name[20]
}
void main()
{
struct student s
s.no = 8
printf("hello")
}
Correct Answer

(A) Compile time error

[#130] Which of the following is false about typedef?
Correct Answer

(B) typedef defined substitutes can be redefined again. (Eg: typedef char a typedef int a )