Expression Evaluation in Java
☰Fullscreen
Table of Content:
- Question 1:
What is the value of y after evaluating the expression given below?
y+= ++y + y-- + --y; when int y=8
- Question 2: Write a Java expression for the following: \[ \begin{align} ax^5 + bx^3 + c \end{align} \]
- Question 3: What is the value of x1 if x=5?
x1= ++x – x++ + --x - Question 4:
Give the output of the following expression:
a+= a++ + ++a + --a + a-- ; when a = 7
- Question 5: Write down java expression for: \[ \begin{align} \\ & T = \sqrt{A^2 + B^2 + C^2} \end{align} \]
- Question 6: If int y = 10 then find int z = (++y * (y++ + 5));
- Question 7:
Write the Java expressions for:
\[ \begin{align} \\ & \frac{a^2 + b^2}{2ab} \end{align} \] - Question 8: Give the output of the following method:
public static void main (String [] args){ int a = 5; a++; System.out.println(a); a -= (a--) - (--a); System.out.println(a);} - Question 9: What will be the result stored in x after evaluating the following expression?
int x = 4; x += (x++) + (++x) + x; - Question 10:
Write an expression in Java for:
z = (5x^3 + 2y)/(x + y) - Question 11: What is the result stored in x, after evaluating the following expression?
Given:
int x = 5;Expression:
x++ * 2 + 3 * --x; - Question 12:
(h) Evaluate the following expression if the value of x=2, y=3 and z=1.
v=x + --z + y++ + y
- Question 13: Write a Java expression for the following:
\[ \frac{\sqrt{3x + x^2}}{a + b} \]