Give the value of each of the following expressions in the specified language. I
ID: 3777301 • Letter: G
Question
Give the value of each of the following expressions in the specified language. If the expression is illegal, give "illegal" as your answer. If the value of an expression is undefined, give "undefined" as your answer. (a) Ada: -2 ** 4 (b) Java: --i != j++ ? i--: + + j Assume that i is 4 and j is 3 before the expression is equated. (c) C: i-- || ++j ? j: i Assume that i is 2 and j is 5 before the expression is evaluated. (d) C: i/--i Assume that i is 2 before the expression is evaluated. (e) C++: d = (i = 4.5) + 1 Assume that i is an int variable and d is a double variable. (f) Ada: 8 rem (abs (4 - 7)) (g) Java: i = j + k Assume that i, j, and k are short variables and that j is 3 and k is 7. (h) APL: 24 30 - 6 times 3Explanation / Answer
a)illegal
b)5 ,as --i=3 which is equal to ++j,after comparison it becomes 4 hence second expression is returned which is ++j=5
c) 5
d)1
e) 5
f) 2
g)undefined,compilation error:
error: incompatible types: possible lossy conversion from int to short short i=j+k;
h) -17.2
//please ask in case of any doubt,Thanks.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.