Pijush Banik
8 years ago

which all of the following are valid expressions in c

A. a=2+(b=5)

B. a=b=c=5

C. a=b%c

D. a=(a+b-c)*2.2

E. all of the above

Answer: Option E

Solution (By Examveda Team)

In C, expressions are combinations of variables, operators, and values that yield a result when evaluated.

Option A: a=2+(b=5) - This is a valid expression. The assignment b=5 is evaluated first, and then 2+(5) is assigned to a.

Option B: a=b=c=5 - This is a valid expression. Multiple assignments are evaluated from right to left, so c is assigned 5, then b is assigned c, and finally a is assigned b.

Option C: a=b%c - This is a valid expression. The modulus operator % calculates the remainder of b divided by c, and the result is assigned to a.

Option D: a=(a+b-c)*2.2 - This is a valid expression. The operations inside the parentheses are evaluated first, followed by multiplication with 2.2, and the result is assigned to a.

Therefore, the correct answer is Option E: all of the above.

This Question Belongs to User Ask Question >> Miscellaneous

Join The Discussion

Related User Ask Questions