LATEST

Wednesday, April 29, 2020

OPERATORS ONE LINER PART 01

OPERATORS ONE LINER PART 01

1) What are operators and what are the various types of operators available in Java?
Ans: Operators are special symbols used in expressions.
The following are the types of operators:
Arithmetic operators,
Assignment operators,
Increment & Decrement operators,
Logical operators,
Biwise operators,
Comparison/Relational operators and
Conditional operators 

 
2) The ++ operator is used for incrementing and the -- operator is used for  decrementing.
a)True                  
b)False
Ans: a. 

 
3) Comparison/Logical operators are used for testing and magnitude.
a)True                     
b)False
Ans: a.

4) Character literals are stored as unicode characters.
a)True                      
b)False
Ans: a.

5) What are the Logical operators?
Ans: OR(|), AND(&), XOR(^) AND NOT(~).

6) What is the % operator?
Ans : % operator is the modulo operator or reminder operator. It returns the reminder of dividing the first operand by second operand.

7) What is the value of 111 % 13?
a)3                  
b)5          
c)7           
d)9
Ans : c.

8) Is &&= a valid operator?
Ans : No.

9) Can a double value be cast to a byte?
Ans : Yes

10) Can a byte object be cast to a double value ?
Ans : No. An object cannot be cast to a primitive value.

No comments:

Post a Comment