Evaluate the following arithmetic expressions and 1st the ty

Evaluate the following arithmetic expressions and 1st the type AND value of the result, such as float 100.0 or int 6. Be aware of the data types of all Intermediate calculations. a. 50 + 43/2 + 6 _____ _____ b. 25.5 + 43%2 + 4.5 _____ _____ c. 25 + 15.0/2 + 3 _____ _____ d. 5 * 3/4 + 2 _____ _____ e. 3.0 * (3%4) + 2 _____ _____ What are the values of a and b after the following statement if the original value of a if 2? b = ++a*4; A. a = 2, b = 8 B. a = 2. b = 24 c. a = 3, b = 8 D. a = 3, b = 12 E. none of the above What are the values of a and b after the following statement if the original value of a it 2? b = 2 * a++; A. a = 2, b = 4 B. a = 2. b = 6 C. a = 3, b = 6 D. a = 3, b = 4 E. none of the above Convert the following values: binary 101010101 to decimal hexadecimal DCBA to binary octal 672 to binary octal 3166 to hexadecimal Give an example of a syntax error, a runtime error and a logic error from one of the closed labs or project programs. Evaluate the following expressions: a. fabs(-5.7) b. pow(3.0, 4.0) c. squareroot (100) d. floor(-10.3) e. squareroot (-4.0) f. floor(6.7) g. cell(4.1) h. cell(-4.1)

Solution

a.)Before solving it, we should know, (int)/(int) will evaluates to int. So, 50 + 43/2 + 6 will be 50 + 21 + 6 = 77 which is of type int.

b.) 25.5 + 43%2 + 4.5 =25.5 + 1 + 4.5 = 31.0 which is of type float.

c.) 25 + 15.0/2 + 3 = 25 + 7.5 + 3 = 35.5 which is of type float.

d.) 5* 3/4 + 2 = 15/4 + 2 = 3+2 = 5 which is of type int.

e.) 3.0 * (3%4) + 2 = 3.0*3 + 2 = 9.0 + 2=11.0 which is of type float.

Hope it helps, do give your response.

 Evaluate the following arithmetic expressions and 1st the type AND value of the result, such as float 100.0 or int 6. Be aware of the data types of all Interme

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site