Which of the following is an invalid assignment operator?
For which of the following, “PI++;” code will fail?
What is the output of this C code? 1. #include
2. int main()
3. {
4. printf("sanfoundry\rclass\n");
5. return 0;
6. }
Which of the following is true for variable names in C?
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 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. }
Result of a logical or relational expression in C is
Which among the following are the fundamental arithmetic operators, ie, performing the desired operation can be done using that operator only?
-
-
-
-
Function tolower(c) defined in library works for
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 x = 2, y = 2;
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 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, 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. int main()
3. {
4. int x = -2;
5. x = x >> 1;
6. printf("%d\n", x);
7. }
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. int main()
3. {
4. int x = 2, y = 1;
5. x *= x + y;
6. printf("%d\n", x);
7. return 0;
8. }
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. }
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. }
Does this compile without error? 1. #include
2. int main()
3. {
4. int k;
5. {
6. int k;
7. for (k = 0; k < 10; k++);
8. }
9. }
Does logical operators in C language are evaluated with short circuit?
The name of the variable used in one function cannot be used in another function
When do you need to use type-conversions?
What is the output of this C code? 1. #include
2. #include
3. int main()
4. {
5. char *str = "x";
6. char c = 'x';
7. char ary[1];
8. ary[0] = c;
9. printf("%d %d", strlen(str), strlen(ary));
10. return 0;
11. }
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 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. 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 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 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. }
Which of the following is not a valid variable name declaration?
Which is correct with respect to size of the datatypes?
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 a = 4, n, i, result = 0;
5. scanf("%d", n);
6. for (i = 0;i < n; i++)
7. result += a;
8. }
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 is a User-defined data type?
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. }
The code snippet below produces 1. #include
2. void main()
3. {
4. 1 < 2 ? return 1 : return 2;
5. }
Which of the following is not an arithmetic operation?
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 a = 10, b = 5, c = 5;
5. int d;
6. d = a == (b + c);
7. printf("%d", d);
8. }