What is the output of this C code? 1. #include
2. int main()
3. {
4. int a = 2;
5. int b = 0;
6. int y = (b == 0) ? a :(a > b) ? (b = 1): a;
7. printf("%d\n", y);
8. }
Which of the following data type will throw an error on modulus operation(%)?
What is the output of this C code? 1. #include
2. int main()
3. {
4. unsigned int i = 23;
5. signed char c = -23;
6. if (i > c)
7. printf("Yes\n");
8. else if (i < c)
9. printf("No\n");
10. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 1;
5. short int i = 2;
6. float f = 3;
7. if (sizeof((x == 2) ? f : i) == sizeof(float))
8. printf("float\n");
9. else if (sizeof((x == 2) ? f : i) == sizeof(short int))
10. printf("short int\n");
11. }
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. }
When do you need to use type-conversions?
What is the output of this C code? 1, #include
2. int main()
3. {
4. int c = 2 ^ 3;
5. printf("%d\n", c);
6. }
What is the output of this C code? 1. #include
2. void foo(const int *);
3. int main()
4. {
5. const int i = 10;
6. printf("%d ", i);
7. foo(&i);
8. printf("%d", i);
9. }
10. void foo(const int *i)
11. {
12. *i = 20;
13. }
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. }
Which of the datatypes have size that is variable?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 0;
5. int z;
6. z = (y++, y);
7. printf("%d\n", z);
8. return 0;
9. }
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. }
Which of the following typecasting is accepted by C?
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 x = 2, y = 0, l;
5. int z;
6. z = y = 1, l = x && y;
7. printf("%d\n", l);
8. return 0;
9. }
What is the output of this C code? 1. #include
2. void main(
3. {
4. double b = 8;
5. b++;
6. printf("%lf", b);
7. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int a = 5 * 3 % 6 - 8 + 3;
5. printf("%d", a);
6. }
Comment on the output of this C code? 1. #include
2. void main()
3. {
4. int k = 8;
5. int m = 7;
6. int z = k < m ? k = m : m++;
7. printf("%d", z);
8. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. printf("sanfoundry\rclass\n");
5. return 0;
6. }
Function tolower(c) defined in library works for
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2;
5. x = x << 1;
6. printf("%d\n", x);
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. }
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. }
Which of the following declaration is not supported by C?
Which of the following declaration is illegal?
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. char c;
5. int i = 0;
6. FILE *file;
7. file = fopen("test.txt", "w+");
8. fprintf(file, "%c", 'a');
9. fprintf(file, "%c", -1);
10. fprintf(file, "%c", 'b');
11. fclose(file);
12. file = fopen("test.txt", "r");
13. while ((c = fgetc(file)) != -1)
14. printf("%c", c);
15. return 0;
16. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = -2;
5. x = x >> 1;
6. printf("%d\n", x);
7. }
Variable name resolving (number of significant characters for uniqueness of variable) depends on
The format identifier ‘%i’ is also used for _____ data type?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 1, y = 0;
5. x &&= y;
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. 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 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. }
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. }
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. }
Which data type is most suitable for storing a number 65000 in a 32-bit system?
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. int i, n, a = 4;
5. scanf("%d", &n);
6. for (i = 0; i < n; i++)
7. a = a * 2;
8. }
What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y;
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. }