Structure And Union - Study Mode
[#101] What will be the output of the following C code? #include <stdio.h>
struct p
{
int x
char y
}
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96}
struct p *ptr1 = p1
int x = (sizeof(p1) / sizeof(struct p))
printf("%d %d
", ptr1->x, (ptr1 + x - 1)->x)
}
Correct Answer
(D) 1 5
[#102] What will be the output of the following C code? #include <stdio.h>
struct point
{
int x
int y
}
int main()
{
struct point p = {1}
struct point p1 = {1}
if(p == p1)
printf("equal
")
else
printf("not equal
")
}
Correct Answer
(A) Compile time error
[#103] Which of the following structure declaration doesn't require pass-by-reference?
Correct Answer
(D) none of the mentioned
[#104] How many bytes in memory taken by the following C structure? #include <stdio.h>
struct test
{
int k
char c
}
Correct Answer
(A) Multiple of integer size
[#105] What will be the output of the following C code? #include <stdio.h>
typedef struct p
{
int x, y
}k
int main()
{
struct p p = {1, 2}
k k1 = p
printf("%d
", k1.x)
}
Correct Answer
(B) 1