RM Review Question Ans 3rd Chapter
RM Review Question Ans 3rd Chapter
**True or False
(a) All arithmetic operators have the same level of precedence=False.
(b) The modulus operators can be used only with integers=True.
(c) The operators <=, >= and != all enjoy the same level of priority=
False
(d) During modulo division, the sign of the result is positive, if both the
operands are of the same sign=True.
(e) In C , if the data item is zero , it is considered false=True.
(f) The expression!(x<=y) is same as the expression x>y =True.
(g) A unary expression consists of only one operand with no operators=
False.
(h) Associativity is used to decide which of several different expression is
evaluated first= False.
(i) An expression statement is terminated with a period=False.
(j) During the evaluation of mixed expressions, an implicit cast is generated
automatically=True.
(k) An explicit cast can be used to change the expression=True.
(l) Parentheses can be used to change the order of evaluation
expressions=True.
int a=10,b=20,c;
No Expressions Validity
A !(5+5)>=10) False
B 5+5==10||1+3==5 True
C 5>10||10<20&&3<5 True
D 10!=15&&!(10<20)||15>30 False
No Expression Value
a a>b && a<c 0
b a<b && a>c 1
c a==c && b>a 1
d b>15 && c<0 || a>0 1
Output: Output:
Error: Correct 'and' sign is '&&' Error: =<
Correct: <=
int x=10;
float y=4.25;
x= y%x;
Error: Illegal use of floating point.
Solution: Solution:
#include<stdio.h> #include<stdio.h>
#include<conio.h> #include<conio.h>
int main() int main()
{ {
int m; int m=-14,n=3;
for(m=0;m<3;++m) printf("%d\n",m/n*10);
printf("%d\n",(m%2)?m:m+2); n=-n;
return 0; printf("%d",m/n*10);
} return 0;
Output: }
2 Output:
1 -40
4 40
----- 0 -----