What is the output of this program?
#include
struct test {
int x;
char y;
} test;
int main()
{
test.x = 10;
test.y = 'A';
printf("%d %c", test.x,test.y);
return 0;
}
Answer: A
No answer description available for this question
Enter details here
Pick the best statement for the below program:
#include "stdio.h"
int main()
{
struct {int a[2], b;} arr[] = {[0].a = {1}, [1].a = {2}, [0].b = 1, [1].b = 2};
printf("%d %d ?nd",arr[0].a[0],arr[0].a[1],arr[0].b);
printf("%d %d %dn",arr[1].a[0],arr[1].a[1],arr[1].b);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
Which of the following statement is True?
Answer: C
No answer description available for this question
Enter details here
Pick the best statement for the below program:
#include "stdio.h"
int main()
{
struct {int i; char c;} myVar = {.c ='A',.i = 100};
printf("%d %c",myVar.i, myVar.c);
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
Which properly declares a variable of struct foo?
Answer: B
No answer description available for this question
Enter details here
Point out the error (if any) in the following C code?
#include
enum hello
{
a,b,c;
};
main()
{
enum hello m;
printf("%d",m);
}
Answer: B
In the above code, there is a semi colon given at the end of the list of variables. This results in an error. Semi colon is to be put only after the closing brace of the enum, not after the list of variables.
Enter details here
Pick the incorrect statement with respect to enums.
Answer: A
No answer description available for this question
Enter details here
What is the output of this program?
#include
struct student
{
int no = 5;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf("hello");
}
Answer: B
No answer description available for this question
Enter details here
What is the output of this program?
#include
int main(){
struct simp
{
int i = 6;
char city[] = "chennai";
};
struct simp s1;
printf("%d",s1.city);
printf("%d", s1.i);
return 0;
}
Answer: D
Compilation Error: Cannot initialize a class member here When we declared members in struture, it just tells the compiler about their presence. There is no memory allocated for that members. So we can't intialize structure members.
Enter details here
What will be the output of the following C code?
#include
enum class
{
a,b,c
};
enum class m;
main()
{
printf("%d",sizeof(m));
}
Answer: B
No answer description available for this question
Enter details here