TECHNICAL-CSE
1. What is the output of this C code?
#include <stdio.h>
int main()
{ a) Compile time error
int i = -3; b) -1
int k = i % 2; c) 1
printf("%d\n", k); d) Implementation defined
}
2. What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 3; a) Compile time error
int l = i / -2; b) -1 1
int k = i % -2; c) 1 -1
printf("%d %d\n", l, d) Implementation defined
k);
return 0;
}
3. What is the output of this C code?
#include <stdio.h>
int main()
{ a) Implementation defined
int i = 5; b) 1
i = i / 3; c) 3
printf("%d\n", i); d) Compile time error
return 0;
}
4. What is the output of this C code?
#include <stdio.h>
int main()
{ a) Implementation defined
int i = -5; b) -1
i = i / 3; c) -3
printf("%d\n", i); d) Compile time error
return 0;
}
5. What is the value of x in this C code?
#include <stdio.h> a) 3.75
void main() b) Depends on compiler
{ c) 24
int x = 5 * 9 / 3 + 9; d) 3
}
6. What is the output of this C code?
#include <stdio.h>
void main() a) Value of x is 2.3
{ b) Value of x is 1
int x = 5.3 % 2; c) Value of x is 0.3
printf("Value of x is %d", x); d) Compile time error
}
7. What is the output of this C code?
#include <stdio.h>
void main()
{ a) Value of x is 1
int y = 3; b) Value of x is 2
int x = 5 % 2 * 3 / 2; c) Value of x is 3
printf("Value of x is %d", d) Compile time error
x);
}
8. The precedence of arithmetic operators is (from highest to lowest)
a) %, *, /, +, - b) %, +, /, *, - c) +, -, %, *, / d) %, +, -, *, /
9. Which of the following is not an arithmetic operation?
a) a *= 10; b) a /= 10; c) a != 10; d) a %= 10;
10. Which of the following data type will throw an error on modulus operation(%)?
a) char b) short c) int d) float
11. What is the output of this C code?
#include <stdio.h>
int main()
{ a) 15
int a = 10; b) 16
double b = 5.6; c) 15.6
int c; d) 10
c = a + b;
printf("%d", c);
}
12. What is the output of this C code?
#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5; a) Syntax error
int d; b) 1
d = a == (b + c); c) 10
printf("%d", d); d) 5
}
13. What is the output of this C code?
#include <stdio.h>
void main()
{ a) 6
int x = 1, y = 0, z = 5; b) 5
int a = x && y || z++; c) 0
printf("%d", z); d) Varies
}
14. What is the output of this C code?
#include <stdio.h>
void main() a) 6
{ b) 5
int x = 1, y = 0, z = 5; c) 0
int a = x && y && z++; d) Varies
printf("%d", z);
}
15. What is the output of this C code?
#include <stdio.h>
int main() a) 3
{ b) 1
int x = 1, y = 0, z = 3; c) Compile time error
x > y ? printf("%d", z) : d) Run time error
return z;
}
16. What is the output of this C code?
#include <stdio.h>
void main()
{ a) -2147483648
int x = 1, z = 3; b) -1
int y = x << 3; c) Run time error
printf(" %d\n", y); d) 8
}
17. What is the output of this C code?
#include <stdio.h>
void main()
{ a) 3
int x = 0, y = 2, z = 3; b) 0
int a = x & y | z; c) 2
printf("%d", a); d) Run time error
}
18. What is the final value of j in the below code?
#include <stdio.h>
int main()
{ a) 0
int i = 0, j = 0; b) 10
if (i && (j = i + 10)) c) Depends on the compiler
//do something d) Depends on language standard
;
}
19. What is the final value of j in the below code?
#include <stdio.h>
int main()
{ a) 0
int i = 10, j = 0; b) 20
if (i || (j = i + 10)) c) Compile time error
//do something d) Depends on language standard
;
}
20. Result of a logical or relational expression in C is
a) True or False
b) 0 or 1
c) 0 if expression is false and any positive number if expression is true
d) None of the mentioned
21. What will be the value of d in the following program?
#include <stdio.h>
int main()
{ a) Syntax error
int a = 10, b = 5, c = 5; b) 1
int d; c) 5
d = b + c == a; d) 10
printf("%d", d);
}
22. What is the output of this C code?
#include <stdio.h>
int main()
{ a) 5 1
int a = 10, b = 5, c = 3; b) 0 3
b != !a; c) 5 3
c = !!a; d) 1 1
printf("%d\t%d", b, c);
}
23. Which among the following is NOT a logical or relational operator?
a) != b) == c) || d) =
24. What is the output of this C code?
#include <stdio.h>
void main()
{ a) Advanced C Classes
float x = 0.1; b) Sanfoundry
if (x == 0.1) c) Run time error
printf("Sisir"); d) Compile time error
else
printf("Advanced C Classes");
}
25. Comment on the output of this C code?
#include <stdio.h>
void main()
{ a) 0.100000, junk value
float x = 0.1; b) Junk value, 0.100000
printf("%d, ", x); c) 0, 0.100000
printf("%f", x); d) 0, 0.999999
}
ALL THE BEST