Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants.
Answer: A
Arithmetic operations such as addition, subtraction, multiplication and division are allowed on enumerated constants. Valid arithmetic operators are +, -, *, / and %.
Enter details here
What will be the output of the following C code?
#include
enum colour
{
blue, red, yellow
};
main()
{
enum colour c;
c=yellow;
printf("%d",c);
}
Answer:
Enter details here
Assume that this code is running on 64 bit system
#include
enum Xenum{
C, CPP, Java
};
int main()
{
enum Xenum var;
printf("%d",sizeof(var));
return 0;
}
Answer: C
No answer description available for this question
Enter details here
Which of the following are themselves a collection of different data types?
Answer: B
No answer description available for this question
Enter details here
Arithmetic operations are not allowed on enumerated constants.
Answer: B
No answer description available for this question
Enter details here
What is the output of this program?
#include
struct student
{
char *c;
};
void main()
{
struct student s[2];
printf("%d", sizeof(s));
}
Answer: D
No answer description available for this question
Enter details here
#include
struct st
{
int x;
struct st next;
};
int main()
{
struct st temp;
temp.x = 10;
temp.next = temp;
printf("%d", temp.next.x);
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
Find the output of below C program
#include "stdio.h"
typedef enum{
Male, Female
}SEX;
int main()
{
SEX var = Male;
printf("%d",var);
return 0;
}
Answer:
Enter details here
What will be the output of the following C code if the code is executed on a 32 bit platform?
#include
enum sanfoundry
{
c = 0,
d = 10,
h = 20,
s = 3
} a;
int main()
{
a = c;
printf("Size of enum variable = ?ytes", sizeof(a));
return 0;
Answer: C
The size of an enum variable is equal to the size of an integer. The size of an integer on a 32 bit platform is equal to 4 bytes.
Enter details here
Pick the best statement for the below program:
#include "stdio.h"
int main()
{
struct {int a[2];} arr[] = {{1},{2}};
printf("%d %d %d %d",arr[0].a[0],arr[0].a[1],arr[1].a[0],arr[1].a[1]);
return 0;
}
Answer: D
No answer description available for this question.
Enter details here