If int y = 10 then find int z = (++y * (y++ + 5));

1 Answer

Answer :

Ans. Increment operator has the highest precedence. So, ++y and y++ will be evaluated starting from left.
In ++y, the value of y will be incremented to 11 and then 11 will be used in the expression.
When y++ is evaluated, the current value of y i.e. 11 will be used and then y will be incremented from 11 to 12.
int z = (++y * (y++ + 5));
= 11 * (11 + 5 )
= 11 * 16
= 176

Related questions

Description : What are the types of casting shown by the following examples: (i) char c = (char)120; (ii) int x = ‘t’;

Last Answer : Ans. (i) Explicit casting (ii) Implicit casting

Description : int res = ‘A’; What is the value of res?

Last Answer : Ans. res will hold the ASCII value of ‘A’ which is 65.

Description : Classify the following as primitive or non-primitive data types: (i) char (ii) arrays (iii) int (iv) classes

Last Answer : Ans. (i) char – Primitive (ii) arrays – Non primitive (iii) int – Primitive (iv) Classes – Non primitive

Description : Name any two library packages.

Last Answer : Ans. java.util, java.io

Description : Write one difference between / and % operator.

Last Answer : Ans. / is division operator while % is modulus operator which gives the remainder on dividing two numbers.

Description : Name the operators listed below i) < ii) ++ iii) && iv) ?:

Last Answer : Ans. i) Less than comparison operator ii) Increment operator iii) And logical operator iv) Ternary operator

Description : Write the output for the following: System.out.println(“Incredible” + “\n” + “world”);

Last Answer : Incredible world

Description : System.out.print(“BEST “); System.out.println(“OF LUCK”); Choose the correct option for the output of the above statements: (i) BEST OF LUCK (ii) BEST OF LUCK

Last Answer : Ans. (i) is the correct output. System.out.print() does not add a new line at the end because of which ‘OF LUCK’ gets printed on the same line as ‘BEST’.

Description : What is meant by a package.Give an example

Last Answer : Ans. Package in Java is a mechanism to encapsulate a group of classes, sub packages and interfaces., examples : lang , io , util etc..

Description : If the value of basic = 1500, what will be the value of tax after the following statement is executed tax = basic > 1200 ? 200 : 100

Last Answer : Ans. 200

Description : Write a difference between Unary and Binary Operator

Last Answer : Ans. Operators that acts on one operand are referred to as Unary Operators while Binary Operators acts upon two operand Unary + or Unary – , increment/decrement are the example of Unary operator While binary operator +,-,*,/ and % are the example of binary operators , (+) adds values of its operands

Description : How many times does the following code segment execute int x=1, y=10, z=1; do{y--; x++; y-=2; y=z; z++} while (y>1 && z

Last Answer : A) 1

Description : A three dimensional array in C' is declared as int A[x][y][z]. Here, the address of an item at the location A[p][q][r] can be computed as follows (where w is the word length of an integer): (A) &A[0][0][0]+w(y*z*q+z*p+r) (B) &A ... *q+r) (C) &A[0][0][0]+w(x*y*p+z*q+r) (D) &A[0][0][0]+w(x*y*q+z*p+r)

Last Answer : Answer: B

Description : `int sec^(2) " z dz "`

Last Answer : `int sec^(2) " z dz "`

Description : If `int (x^(2020)+x^(804)+x^(402))(2x^(1608)+5x^(402)+10)^(1//402)dx=(1)/(10a)(2x^(2010)+5x^(804)+10^(402))^(a//402)`. Then `(a-400)` is equal to ....

Last Answer : If `int (x^(2020)+x^(804)+x^(402))(2x^(1608)+5x^(402)+10)^(1//402)dx=(1)/(10a)(2x^(2010)+5x^(804)+ ... )^(a//402)`. Then `(a-400)` is equal to .......

Description : The correct way to round off a floating number x to an integer value is (A) y = (int)(x+0.5) (B) y = int(x+0.5) (C) y = (int)x+0.5 (D) y = (int)((int)x+0.5)

Last Answer : (A) y = (int)(x+0.5)

Description : Arrange the following primitive data types in an ascending order of their size: (i) char (ii) byte (iii) double (iv) int

Last Answer : Ans. The sizes of the given data types are as follows char = 2 bytes byte = 1 byte double = 8 bytes int = 4 bytes Arranging them in ascending order gives byte < char < int < double

Description : What are the default values of the primitive datatypes int and float?

Last Answer : Ans. The default value of int is 0 and the default value of float is 0.0f.

Description : State the number of bytes occupied by char and int data types.

Last Answer : Ans. char occupies two bytes and int occupied 4 bytes.

Description : Classify the following as primitive or non-primitive data types: (i) char (ii) arrays (iii) int (iv) classes

Last Answer : Ans. (i) char – Primitive (ii) arrays – Non primitive (iii) int – Primitive (iv) Classes – Non primitive

Description : Assume that variable x resides at memory location 1234, y at 1111 and p at 2222. Int x=1, y=2, *p; p=&x; y=*p; What will be the value of y after execution of above code? A) 2 B) 1 C) 1234 D) 1111

Last Answer : C) 1234

Description : When the following code is executed what will be the value of x and y? int x = 1, y=0; y = x++; (A) 2, 1 (B) 2, 2 (C) 1, 1 (D) 1, 2

Last Answer : (A) 2, 1

Description : If x+y=10 and x=z then show that z+y=10 by using appropriate eculids axioms? -Maths 9th

Last Answer : This answer was deleted by our moderators...

Description : If x+y =10 and x=z then show that z+y =10 -Maths 9th

Last Answer : It is given that x+y =10 Also x= z Therefore, x+y =10 Z+y =10 ( x = z)

Description : If x+y=10 and x=z then show that z+y=10 by using appropriate eculids axioms? -Maths 9th

Last Answer : This answer was deleted by our moderators...

Description : If x+y =10 and x=z then show that z+y =10 -Maths 9th

Last Answer : It is given that x+y =10 Also x= z Therefore, x+y =10 Z+y =10 ( x = z)

Description : It is known that if x+y =10, then x+y+z = 10+z.Which axiom of Euclids does this statement illustrate? -Maths 9th

Last Answer : Solution :- Second axiom.

Description : X, Y and Z can complete a piece of work in 10 days. X and Y can do it in 20 days. Then Z alone can complete the work in ……………… days.

Last Answer : X, Y and Z can complete a piece of work in 10 days. X and Y can do it in 20 days. Then Z alone can complete the work in ……………… days.

Description : A man picks up a 50 kilogram block and carries it up a flight of stairs 10 meters high. He then carries the block back down the stairs and places the block in its original position. What is the NET work done on the block? w) 1,000 joules x) 750 joules y) 500 joules z) 0 joules

Last Answer : ANSWER: Z -- 0 JOULES

Description : `" if " int (sin 2x- cos 2x) dx=(1)/(sqrt(2)) sin (2x-k)+c " then " k=?`

Last Answer : `" if " int (sin 2x- cos 2x) dx=(1)/(sqrt(2)) sin (2x-k)+c " then " k=?` A. `-(5pi)/(4)` B. `(pi)/(4)` C. `-(pi)/(4)` D.

Description : If conductor pass energy then my question is that heat energy change int electrical of wire?

Last Answer : Conductor losses or "I squared R losses" occur when electric current flows through a conductor. Conductor loss in watts equals the square of the current in amperes (I2) multiplied by the resistance of the conductor in ohms (R), and each watt of electrical energy is equal to 1 joule of heat.

Description : What is the value returned by the function f given below when n = 100 ? int f(int n)  { if (n==0) then return n;  else return n + f(n-2);  } (A) 2550 (B) 2556 (C) 5220 (D) 5520

Last Answer : (A) 2550

Description : A resistance of `4 Omega` and a wire of length 5 meters and resistance `5 Omega` are joined in series and connected to a cell of e.m.f. `10 V` and int

Last Answer : A resistance of `4 Omega` and a wire of length 5 meters and resistance `5 Omega` are joined in series and connected ... `3.0V` C. `0.67V` D. `1.33V`

Description : If you want to cut the selected item, you will press: a) Ctrl + Y b) Ctrl + Z c) Ctrl + X d) None of These

Last Answer : c) Ctrl + X

Description : Is this program statement valid? INT = 10.50;

Last Answer : Assuming that INT is a variable of type float, this statement is valid. One may think that INT is a reserved word and must not be used for other purposes. Define, However, recall that reserved words are express in lowercase, so the C compiler will not interpret this as a reserved word.

Description : What will be the values of x, m and n after execution of the following statements? Int x, m, n; m=10; n=15; x= ++m + n++; A) x=25, m=10, n=15 B) x=27, m=10, n=15 C) x=26, m=11, n=16 D) x=27, m=11, n=16

Last Answer : C) x=26, m=11, n=16

Description : What does the following declaration mean ? int (*ptr) [10]; (A) ptr is an array of pointers of 10 integers. (B) ptr is a pointer to an array of 10 integers. (C) ptr is an array of 10 integers. (D) none of the above.

Last Answer : (B) ptr is a pointer to an array of 10 integers.

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : If ` x : y = 5 : 6 and y : z = 3 : 7 `, then find x : z.

Last Answer : If ` x : y = 5 : 6 and y : z = 3 : 7 `, then find x : z.

Description : A girl throws a 0.1 kilogram ball at a wall. The ball hits the wall perpendicularly with a velocity of 5 meters per second and then bounces straight back with a velocity of 4 meters per second. The ... .4 kilogram-meters per second y) 0.5 kilogram-meters per second z) 0.9 kilogram-meters per second

Last Answer : ANSWER: Z -- 0.9 KILOGRAM-METERS PER SECOND 

Description : Compute the value of adding the following two fuzzy integers: A = {(0.3,1), (0.6,2), (1,3), (0.7,4), (0.2,5)} B = {(0.5,11), (1,12), (0.5,13)} Where fuzzy addition is defined as μA+B(z) = maxx+y=z (min(μA(x), μB( ... ,18)} (D) {(0.3,12), (0.5,13), (0.6,14), (1,15), (0.7,16), (0.5,17), (0.2,18)}

Last Answer : (D) {(0.3,12), (0.5,13), (0.6,14), (1,15), (0.7,16), (0.5,17), (0.2,18)} 

Description : X, Y, Z started a business with their investment in the ratio of 4/5: 4/7: 5/9, after 6months. X has withdrawn half of his investment. Also X will get 30% of profit for being an active partner. At the ... Rs. 54750. Then find the total profit earned by Y and Z? A) 25200 B) 28600 C) 25010 D) 26867

Last Answer : Answer: C) Let investment of X, Y, Z be 4/5 x,4/7x &5/9 x =>252x, 180x & 175x Profit ratio of X, Y, Z is 252x*6+126x*6:180x*12 :175x *12 =189:180:175 Active partner X's amount= ... 30/100 =Rs.16425 Remaining profit =54750-16425 =Rs.38325 Total profit earned by Y*Z= 38325*355/544 =Rs. 25010