What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 1, y = 2;
5. if (x && y == 1)
6. printf("true\n");
7. else
8. printf("false\n");
9. }
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. const int i = 10;
5. int *ptr = &i;
6. *ptr = 20;
7. printf("%d\n", i);
8. return 0;
9. }
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. 1 < 2 ? return 1: return 2;
5. }
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. }
Are logical operators sequence points?
Comment on the following expression? c = (n) ? a : b; can be rewritten as
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 0;
5. int z = (y++) ? y == 1 && x : 0;
6. printf("%d\n", z);
7. return 0;
8. }
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. void main()
3. {
4. int k = 8;
5. int x = 0 == 1 && k++;
6. printf("%d%d\n", x, k);
7. }
C99 standard guarantees uniqueness of ____ characters for internal names.
What is the output of this C code? 1. #include
2. void main()
3. {
4. int k = 4;
5. float k = 4;
6. printf("%d", k)
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. }
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. }
Which of the following type-casting have chances for wrap around?
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. }
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. }
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. 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. int main()
3. {
4. int i = 2;
5. int j = ++i + i;
6. printf("%d\n", j);
7. }
Relational operators cannot be used on:
Which of the following declaration is not supported by C?
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 0, y = 2, z = 3;
5. int a = x & y | z;
6. printf("%d", a);
7. }
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 is correct with respect to size of the datatypes?
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. int x = 3; //, y = 2;
5. const int *p = &x;
6. *p++;
7. printf("%d\n", *p);
8. }
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 size of an int data type?
Which data type is most suitable for storing a number 65000 in a 32-bit system?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int i = 23;
5. char c = -23;
6. if (i < c)
7. printf("Yes\n");
8. else
9. printf("No\n");
10. }
Which of the following declaration is illegal?
Operation “a = a * b + a” can also be written as:
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 0;
5. if (x = 0)
6. printf("Its zero\n");
7. else
8. printf("Its not zero\n");
9. }
For initialization a = 2, c = 1 the value of a and c after this code will be c = (c) ? a = 0 : 2;
Which is valid C expression?
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. }