[SOLVED] COMP2113 Module3-Self-Review Exercise

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Module3-sferv9.zip (2534.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

 

  1. Evaluate the following expressions:
    1. 36 / 5
    2. 18 − 32 / 6 * 3
    3. 6 − 8 % 11
    4. 0 / 5
    5. 25 − 7 % 3 + 8 / 3
    6. 0 + 5.0 * 3.0 / 4.0
  2. Suppose x, y, and z are int variables and x = 2, y = 5, and z = 6. What is the output of each of the following statements?
    1. cout << “x = ” << x << “, y = ” << y << “, z = ” << z;
    2. cout << “Sum of ” << x << ” and ” << z << ” is ” << x + z;
    3. cout << “2 times ” << x << ” = ” << 2 * x;

 

  1. The following program has syntax mistakes. Correct them. On each successive line, assume that any preceding error has been corrected.

 

const char = STAR = ‘*’ const int PRIME = 71; int main {

int count, sum;  double x;    count = 1;  sum = count + PRIME;    x := 25.67;       newNum = count * ONE + 2;     sum + count = sum;  x = x + sum * COUNT;

cout << ” count = ” << count << “, sum = ” << sum

<< “, PRIME = ” << Prime << endl;

}

  1. Suppose a, b, and c are int variables and a = 5 and b = 6. What value is assigned to each variable after each statement executes? If a variable is undefined at a particular statement, report UND (undefined).
a b c
a = (b++) + 3;
c = 2 * a + (++b);
b = 2 * (++c) – (a++);

 

 

  • Module3-sferv9.zip