Subscribe Us

Core Java - Interview Questions and Answers

Operators

131. 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

132. The ++ operator is used for incrementing and the -- operator is used for
decrementing.

a)True
b)False
Ans: a.

133. Comparison/Logical operators are used for testing and magnitude.

a)True
b)False
Ans: a.

134.Character literals are stored as unicode characters.

a)True
b)False
Ans: a.

135. 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.

136. What is the value of 111 % 13?

3
5
7
9
Ans : c.

137. Is &&= a valid operator?

Ans : No.

138. Can a double value be cast to a byte?

Ans : Static variables are shared by all instances of a class.

139. What are order of precedence and associativity?

Ans : Order of precedence the order in which operators are evaluated in expressions.
Associativity determines whether an expression is evaluated left-right or right-left.

140. Which Java operator is right associativity?

Ans : = operator.


Post a Comment

0 Comments