Uploaded by Vijay tv promos

SIP Phase III C Training Quiz Questions - Operators

advertisement
SIP
Phase III
C Training Questions
1. What is the result of the expression 5 + 7 * 2 in C?
a) 24
b) 19
c) 26
d) 17
2. Which operator is used for logical OR in C?
a) &&
b) |
c) &
d) ||
3. What does ++ operator do in C when applied to a variable?
a) Decrements by 1
b) Add by 1
c) Doubles the value
d) Leaves it unchanged
4. Which operator is used for modules division in C?
a) %
b) .
c) *
d) &
5. Which operator is used for equality comparison in C?
a) ==
b) !=
c) =
d) <>
6. Which operator is used for inequality comparison in C?
a) ==
b) !=
c) =
d) <>
7. What is the result of the expression 5*(1+2)-3?
a) 12
b) 15
c) 10
d) 6
8. Which of the following comments are true about ++ operator?
a) It is unary operator
b) The operand can come before or after the operator
c) It associates from right
d) All of the above
9. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = -3;
int k = i % 2;
printf("%d\n", k);
}
a) Compile time error
b) -1
c) 1
d) None of the above
10. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 5;
i = i / 3;
printf("%d\n", i);
return 0;
}
a) Compile time error
b) 1
c) 3
d) Depends on Compiler
11. What is the result of a logical or relational expression in C?
a) 0 or 1
b) True or false
c) 0 if false and a positive number if true.
d) T or F
12. What is the operator ‘?:’ called?
a) If-Else operator
b) Ternary operator
c) Logical operator
d) Comparison operator
13. The expression 4 + 6 / 3 * 2 - 2 + 7 % 3 evaluates to
a) 3
b) 4
c) 6
d) 7
14. What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 5;
int j = i / -4;
int k = i % -4;
printf("%d %d\n", j, k);
return 0;
}
a) Compile time error
b) -1 1
c) 1 -1
d) 1 1
15. What is the output of the following statements?
#include <stdio.h>
int main()
{
int b = 15, c = 5, d = 8, e = 8, a;
a = b>c ? c>d ? 12 : d > e ? 13 : 14 : 15;
printf("%d", a);
return 0;
}
a) 13
b) 14
c) 15
d) 12
Download