What is the output of this C code (on a 32-bit machine)? 1. #include
2. int main()
3. {
4. int x = 10000;
5. double y = 56;
6. int *p = &x;
7. double *q = &y;
8. printf("p and q are %d and %d", sizeof(p), sizeof(q));
9. return 0;
10. }
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 3, y = 2;
5. int z = x << 1 > 5;
6. printf("%d\n", z);
7. }
Which of the following is not a valid variable name declaration?
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. int ThisIsVariableName = 12;
5. int ThisIsVariablename = 14;
6. printf("%d", ThisIsVariablename);
7. return 0;
8. }
Does this compile without error? 1. #include
2. int main()
3. {
4. for (int k = 0; k < 10; k++);
5. return 0;
6. }
Which of the following data type will throw an error on modulus operation(%)?
Which is valid C expression?
What is the output of this C code? 1. #include
2. int main()
3. {
4. signed char chr;
5. chr = 128;
6. printf("%d\n", chr);
7. return 0;
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 x = 1, z = 3;
5. int y = x << 3;
6. printf(" %d\n", y);
7. }
Which of the following is not a valid variable name declaration?
For which of the following, “PI++;” code will fail?
What is the output of this C code? 1. #include
2. int main()
3. {
4. int x = 2, y = 2;
5. x /= x / y;
6. printf("%d\n", x);
7. return 0;
8. }
What will be the value of d in the following program? 1. #include
2. int main()
3. {
4. int a = 10, b = 5, c = 5;
5. int d;
6. d = b + c == a;
7. printf("%d", d);
8. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int x = 4, y, z;
5. y = --x;
6. z = x--;
7. printf("%d%d%d", x, y, z);
8. }
What is the output of this C code? 1. #include
2. void main()
3. {
4. int a = 3;
5. int b = ++a + a++ + --a;
6. printf("Value of b is %d", 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. }
Which of the following declaration is not supported by C?
Which among the following are the fundamental arithmetic operators, ie, performing the desired operation can be done using that operator only?
-
-
-
-
Which of the following is not a pointer declaration?
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. }
Operation “a = a * b + a” can also be written as:
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. int i = 2;
5. int i = i++ + i;
6. printf("%d\n", i);
7. }
What is 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++;
7. printf("%d", z);
8. }
What is the output of the code given below 1. #include
2. int main()
3. {
4. int x = 0, y = 2;
5. if (!x && y)
6. printf("true\n");
7. else
8. printf("false\n");
9. }
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. }
Which of the following is a User-defined data type?
Variable names beginning with underscore is not encouraged. Why?
Comment on the output of this C code? 1. #include
2. int main()
3. {
4. int i = 2;
5. int i = i++ + i;
6. printf("%d\n", i);
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. int main()
3. {
4. int x = 2;
5. x = x << 1;
6. printf("%d\n", x);
7. }
Function tolower(c) defined in library works for
What is the output of this C code? 1. #include
2. int main()
3. {
4. printf("sanfoundry\rclass\n");
5. return 0;
6. }
What will happen if the below program is executed? 1. #include
2. int main()
3. {
4. int main = 3;
5. printf("%d", main);
6. return 0;
7. }
Which of the following is not an arithmetic 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 final value of j in the below code? 1. #include
2. int main()
3. {
4. int i = 10, 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. printf("sanfoundry\r\nclass\n");
5. return 0;
6. }
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. }
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. }