Consider the following C declaration
struct (
short s[5];
union {
float y;
long z;
}u;
}t;
Assume that the objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment consideration, is
Answer: B
No answer description available for this question.
Enter details here
Which of the following cannot be a structure member?
Answer: A
No answer description available for this question
Enter details here
Size of a union is determined by size of the.
Answer: D
No answer description available for this question
Enter details here
The correct syntax to access the member of the ith structure in the array of structures is?
Assuming:
struct temp
{
int b;
}s[50];
Answer: D
The correct syntax to access the member of the ith structure in the array of structures is s[i].b;
Enter details here
Pick the best statement for the below program snippet:
struct {int a[2];} arr[] = {1,2};
Answer: C
No answer description available for this question.
Enter details here
What is the output of this program?
#include
int main()
{
enum days {MON=-1, TUE, WED=4, THU, FRI, SAT};
printf("%d, %d, %d, %d, %d, %d", MON, TUE, WED, THU, FRI, SAT);
return 0;
}
Answer: A
No answer description available for this question
Enter details here
Predict the output of following C program
#include
struct Point
{
int x, y, z;
};
int main()
{
struct Point p1 = {.y = 0, .z = 1, .x = 2};
printf("%d %d %d", p1.x, p1.y, p1.z);
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
enum sanfoundry
{
a,b,c=5
};
int main()
{
enum sanfoundry s;
b=10;
printf("%d",b);
}
Answer: A
The above code results in an error. This is because it is not possible to change the values of enum constants. In the code shown above, the statement: b=10; causes the error.
Enter details here
What will be the output of the following C code?
#include
enum sanfoundry
{
a=1,b,c,d,e
};
int main()
{
printf("%d",b*c+e-d);
}
Answer: B
Since arithmetic operations are allowed on enum constants, hence the expression given is evaluates. b*c+e-d = 2*3+5-4 = 6+5-4 = 7
Enter details here