Structure And Union - Study Mode

[#121] 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)
}
Correct Answer

(D) hello

[#122] Which member of the union will be active after REF LINE in the following C code? #include <stdio.h>
union temp
{
int a
float b
char c
}
union temp s = {1,2.5,’A’}
//REF LINE
Correct Answer

(A) a

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

(A) Compile time error

[#124] Which statement correctly defines a structure named "Person" with members "name" and "age" of type char* and int respectively?
Correct Answer

(A) struct Person { char* name int age }

[#125] What will be the output of the following C code? #include <stdio.h>
union p
{
int x
char y
}
int main()
{
union p p, b
p.y = 60
b.x = 12
printf("%d
", p.y)
}
Correct Answer

(C) 60