What is the output of this C code? 1. #include
2. int main()
3. {
4. float x = 'a';
5. printf("%f", x);
6. return 0;
7. }
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 value of the below assignment expression (x = foo())!= 1 considering foo() returns 2
What is the output of this C code? 1. #include
2. int main()
3. {
4. int y = 1;
5. if (y & (y = 2))
6. printf("true %d\n", y);
7. else
8. printf("false %d\n", y);
9. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int y = 1, x = 0;
5. int l = (y++, x++) ? y : x;
6. printf("%d\n", l);
7. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int a = 2 + 4 + 3 * 5 / 3 - 5;
5. printf("%d", a);
6. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 0;
5. int z = x && y = 1;
6. printf("%d\n", z);
7. }
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. }
The output of the code below is 1. #include
2. void main()
3. {
4. int k = 8;
5. int m = 7;
6. k < m ? k++ : m = k;
7. printf("%d", k);
8. }
for c = 2, value of c after c <<= 1;
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. }
The precedence of arithmetic operators is (from highest to lowest)
-
-
-
-
What is the output of this C code? 1. #include
2. enum birds {SPARROW, PEACOCK, PARROT};
3. enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
4. int main()
5. {
6. enum birds m = TIGER;
7. int k;
8. k = m;
9. printf("%d\n", k);
1o. return 0;
11. }
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. j = 10;
5. printf("%d\n", j++);
6. return 0;
7. }
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. }
Which of the following type-casting have chances for wrap around?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 10, b = 5, c = 5;
5. int d;
6. d = a == (b + c);
7. printf("%d", d);
8. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. char a = 'a';
5. int x = (a % 10)++;
6. printf("%d\n", x);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 1, b = 1, d = 1;
5. printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);
6. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. 1 < 2 ? return 1: return 2;
5. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int a = 5, b = -7, c = 0, d;
5. d = ++a && ++b || ++c;
6. printf("\n%d%d%d%d", a, b, c, d);
7. }
What is the final value of j in the below code? 1. #include
2. int main()
3. {
4. int i = 0, j = 0;
5. if (i && (j = i + 10))
6. //do something
7. ;
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 this C code? 1. #include
2. int main()
3. {
4. int i = -3;
5. int k = i % 2;
6. printf("%d\n", k);
7. }
What is the output of this C code? 1. #include
2. void main()
3.{
4. int x = 4;
5. int *p = &x;
6. int *k = p++;
7. int r = p - k;
8. printf("%d", r);
9. }
Does logical operators in C language are evaluated with short circuit?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 10;
5. double b = 5.6;
6. int c;
7. c = a + b;
8. printf("%d", c);
9. }
What is the value of i and j in the below code? 1. #include
2. int x = 0;
3. int main()
4. {
5. int i = (f() + g()) | g(); //bitwise or
6. int j = g() | (f() + g()); //bitwise or
7. }
8. int f()
9. {
10. if (x == 0)
11. return x + 1;
12. else
13. return x - 1;
14. }
15. int g()
16. {
17. return x++;
18. }
Which of the following format identifier can never be used for the variable var? 1. #include
2. int main()
3. {
4. char *var = "Advanced Training in C by Sanfoundry.com";
5. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. if (7 & 8)
5. printf("Honesty");
6. if ((~7 & 0x000f) == 8)
7. printf("is the best policy\n");
8. }
Which type conversion is NOT accepted?
Which of the following is not an arithmetic operation?
Which of the following is not a valid variable name declaration?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 1, b = 1, c;
5. c = a++ + b;
6. printf("%d, %d", a, b);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 0;
5. int j = i++ + i;
6. printf("%d\n", j);
7. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 3, y = 2;
5. int z = x /= y %= 2;
6. printf("%d\n", z);
7. }
The code snippet below produces 1. #include
2. void main()
3. {
4. 1 < 2 ? return 1 : return 2;
5. }
What is the output of the following C code(on a 64 bit machine)? 1. #include
2. union Sti
3. {
4. int nu;
5. char m;
6. };
7. int main()
8. {
9. union Sti s;
10. printf("%d", sizeof(s));
11. return 0;
12. }