Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The result of integer division is a rounded number. True False In C, the order o

ID: 3854651 • Letter: T

Question

The result of integer division is a rounded number. True False In C, the order of operations specifies that addition is done before multiplication. True False The two C statements below are both expressions for the area of a trapezoid. Which expression will compute the correct result? area = 0.5*(base*height 1 + height 2): area = 0.5*base*(height 1 + height 2): What is the equivalent C statement to the following? x--: neither shown expression x = 1 - x: x = x - 1: both shown expressions The expression 5.0/9.0 will result in 0.555556 in a C program. True False Which of the following operations has the highest priority is C? - () +

Explanation / Answer

Question 6:
The result of integer division is a rounded number.
False. The result of integer division will truncate the floating-point value, and will not be rounded.

Question 7:
In C, the order of operations specifies that addition is done before multiplication.
False. Multiplication is of high precedence than addition. So, multiplication is done prior to addition.

Question 8:
The two C statements below are both expressions for the area of a trapezoid.
Which expression will compute the correct result?

area = 0.5 * (base * height1 + height2);
Here base * height1 will be evaluated first, and then the result will be added to the height2. Finally the result is halved.
So, this is not the way of evaluating the area of trapezoid.

area = 0.5 * base * (height1 + height2);
Here both the heights are added first, then, the base is halved, finally both the values are multiplied together, which produces the correct result.

Question 9:
What is equivalent C statement to the following?
x--; //This is a post decrement statement, and therefore is equivalent to x = x - 1.

Question 10:
The expression 5.0/9.0 will result in 0.555556 in a C program.
True. As both 5, and 9 are floating point numbers here, the result will be a floating point number, and therefore, the result is as specified.

Question 11:
Which of the following operations has the highest priority in C?
In C, braces has the highest precedence. Ofcourse it is not an operator, but any operations written inside the braces will be evaluated prior to the one written outside the braces.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote