Page 171 - Computer science 868 Class 12
P. 171
♦ Arithmetic Operators are used to perform different arithmetical calculations.
♦ Binary Operators work on two operands.
♦ Relational Operators compare two variables or expressions and the resultant output is the relation between them.
♦ Logical Operators return true or false depending on the result of the given condition which depends upon the relationship
between the parameters of the expression.
♦ Bitwise Operators work on the bit level of the operands on which the expression depends. The operands are of Integer Literals
(i.e. byte, int, short and long). It cannot work on Real Literals.
♦ Shift Operators are used for shifting the bits to the value of the first operand right or left. They perform bit manipulation on
data.
♦ There are three different types of shift operators. They are <<, >> and >>>.
♦ Precedence and associativity help to decide which operator to evaluate first when more than one operators are present in
an expression.
MIND DRILL
Solved Questions
A. Tick ( ) the correct option:
1. Which of the following assigns 4.5 to a float variable?
a. f=4.5; b. float f=4.5f;
c. float f = 4.5 d. None of these
2. What will be the output?
final int a=6;
a=a+6;
System.out.println(a);
a. 12 b. 6
c. Will show an error d. None of these
3. The shorthand representation of a=a+6;
a. a+=6 b. a =+6
c. a= 6+a d. All of these
4. What will be the output?
int a=5, b;
b=--a;
System.out.println(a+ " : " + b);
a. 4 : 5 b. 4 : 4
c. 5 : 4 d. None of these
5. An example of a unary postfix decrement operator is ………………… .
a. a++ b. ++a
c. a-- d. --a
6. What will be the value of a in the following statement if a=5 and b=6?
a = a++ + ++b + --a;
a. 18 b. 17
c. 21 d. None of these
169
Variables and Expressions 169

