What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = -2;
5. if (!0 == 1)
6. printf("yes\n");
7. else
8. printf("no\n");
9. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 10, b = 10;
5. if (a = 5)
6. b--;
7. printf("%d, %d", a, b--);
8. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 1, y = 0, z = 5;
5. int a = x && y || z++;
6. printf("%d", z);
7. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int b = 6;
5. int c = 7;
6. int a = ++b + c--;
7. printf("%d", a);
8. }
Which of the following cannot be a variable name in C?
What will be the data type of the result of the following operation? (float)a * (int)b / (long)c * (double)d
Which is valid C expression?
What is the output of this C code? 1. #include
2. void main()
3. {
4. double b = 3 % 0 * 1 - 4 / 2;
5. printf("%lf", b);
6. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 97;
5. int y = sizeof(x++);
6. printf("X is %d", x);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = -5;
5. i = i / 3;
6. printf("%d\n", i);
7. return 0;
8. }
Relational operators cannot be used on:
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 1, b = 2;
5. a += b -= a;
6. printf("%d %d", a, b);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 10, b = 5, c = 3;
5. b != !a;
6. c = !!a;
7. printf("%d\t%d", b, c);
8. }
What is the output of this C code? (7 and 8 are entered) 1. #include
2. void main()
3. {
4. float x;
5. int y;
6. printf("enter two numbers \n", x);
7. scanf("%f %f", &x, &y);
8. printf("%f, %d", x, y);
9. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int var = 010;
5. printf("%d", var);
6. }
What is the output of this C code? 1. #include
2. #define MAX 2
3. enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX};
4. int main()
5. {
6. enum bird b = PARROT;
7. printf("%d\n", b);
8. return 0;
9. }
Comment on the output of this C code? 1. #include
2. void main()
3. {
4. int k = 4;
5. int *const p = &k;
6. int r = 3;
7. p = &r;
8. printf("%d", p);
9. }
Value of c after the following expression (initializations a = 1, b = 2, c = 1): c += (-c) ? a : b;
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 10;
5. int *p = &i;
6. printf("%d\n", *p++);
7. }
For the following code snippet: char *str = “Sanfoundry.com\0” “training classes”; The character pointer str holds reference to string:
What is the output of this C code? 1. #include
2. void main()
3. {
4. double x = 123828749.66;
5. int y = x;
6. printf("%d\n", y);
7. printf("%lf\n", y);
8. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 1;
5. x *= x + y;
6. printf("%d\n", x);
7. return 0;
8. }
What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes? 1. #include
2. int main()
3. {
4. short int i = 20;
5. char c = 97;
6. printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
7. return 0;
8. }
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. float f1 = 0.1;
5. if (f1 == 0.1)
6. printf("equal\n");
7. else
8. printf("not equal\n");
9. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 1;
5. if (i++ && (i == 1))
6. printf("Yes\n");
7. else
8. printf("No\n");
9. }
What is the output of this C code? 1. #include
2. #define a 10
3. int main()
4. {
5. const int a = 5;
6. printf("a = %d\n", a);
7. }
Does this compile without error? 1. #include
2. int main()
3. {
4. for (int k = 0; k < 10; k++);
5. return 0;
6. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. float x = 0.1;
5. if (x == 0.1)
6. printf("Sanfoundry");
7. else
8. printf("Advanced C Classes");
9. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int y = 10000;
5. int y = 34;
6. printf("Hello World! %d\n", y);
7. return 0;
8. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 2;
5. int j = ++i + i;
6. printf("%d\n", j);
7. }
Which keyword is used to prevent any changes in the variable within a C program?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 0;
5. int x = i++, y = ++i;
6. printf("%d % d\n", x, y);
7. return 0;
8. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 0;
5. int z = (y++) ? 2 : y == 1 && x;
6. printf("%d\n", z);
7. return 0;
8. }
Enum types are processed by
What is the output of this C code? 1. #include
2. void main()
3. {
4. int a = -5;
5. int k = (a++, ++a);
6. printf("%d\n", k);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 0, l;
5. int z;
6. z = y = 1, l = x && y;
7. printf("%d\n", l);
8. return 0;
9. }
Which of the following typecasting is accepted by C?
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 97;
5. int y = sizeof(x++);
6. printf("x is %d", x);
7. }
What is the value of the below assignment expression (x = foo())!= 1 considering foo() returns 2