Computer Applications
Given: x += x++ + ++x + --x
Find the value, when x=5.
- 23
- 21
- 22
- 24
Java Operators
63 Likes
Answer
23
Reason — The expression is calculated as follows:
x = x + (x++ + ++x + --x) (x = 5)
x = 5 + (5 + ++x + --x) (x = 6)
x = 5 + (5 + 7 + --x) (x = 7)
x = 5 + (5 + 7 + 6) (x = 6)
x = 5 + 18
x = 23
Answered By
36 Likes
Related Questions
Given: String st = (a>= 90)? "Excellent": "Best";
Predict the output, when a = 90.- Best
- Excellent: Best
- Best: Excellent
- Excellent
Choose the odd one out from the following:
- Unary operator
- Binary operator
- Ternary operator
- Bitwise operator
Identify the type of operator &&:
- ternary
- unary
- logical
- relational
Read the following text and choose the correct answer:
Ternary operator is the only conditional operator that takes three operands. It is a one liner replacement of if-else statement.
Which of the following statements is not true for a ternary operator ?
- It is also called a conditional operator.
- It is a replacement of if-else statement.
- The statement describes in one line only.
- It makes the program lengthy, if applied in Java programming.