R4R
Right Place For Right Person TM
 

R4R Java Core Java Faqs
Previous

Home

Next

Java Operators Interview Questions With Answers

Operators

Q :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:
1.Arithmetic operators,
2.Assignment operators
3.Increment & Decrement operators
4.Logical operators
5.Bitwise operators
6.Comparison/Relational operators
7.Conditional operators

Q :2) The ++ operator is used for incrementing and the -- operator is used for
decrementing.

a)True
b)False

Ans: a.

Q :3) Comparison/Logical operators are used for testing and magnitude.

a)True
b)False

Ans:a.

Q :4) Character literals are stored as unicode characters.

a)True
b)False

Ans: a.

Q :5) What are the Logical operators?

Ans: OR(|), AND(&), XOR(^) AND NOT(~).

Q :6) What is the % operator?

Ans: The % operator is the modulo operator or reminder operator. It returns the reminder of dividing the first operand by second operand.

Q :7) What is the value of 111 % 13?

a.3
b.5
c.7
d.9
Ans: c.

Q :8) Is &&= a valid operator?

Ans: No.


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

Ans: Yes

Q :10) Can a byte object be cast to a double value ?

Ans: No. As an object cannot be cast to a primitive value and here we are casting byte object into double.

Q :11) What are order of precedence and associatively?

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

Q :12) Which Java operator is right associatively?

Ans: Java support =  operator.

Q :13) What is the difference between prefix and postfix of -- and ++ operators?

Ans: The prefix form returns the increment or decrement operation and returns the value of the increment or decrement operation.

The postfix form returns the current value of all of the expression and then
performs the increment or decrement operation on that value.

Q :14) What is the result of expression 5.45 + "3,2"?

a. The double value 8.6
b. The string ""8.6"
c. The long value 8.
d. The String "5.453.2"

Ans: d

Q :15) What are the values of x and y ?

x = 5; y = ++x;

Ans: x = 6; y = 6

Q :16) What are the values of x and z?

x = 5; z = x++;

Ans : x = 6; z = 5
 

Java Operators Interview Questions With Answers

Previous

Home

Next

New Updates

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R