Answered step by step
Verified Expert Solution
Question
1 Approved Answer
10. int a = 100, b = 10, c = 34; d; a. compute d = (a / b)* c + ((c *b) a) /
10. int a = 100, b = 10, c = 34; d;
a. compute d = (a / b)* c + ((c *b) a) / b
b. compute d = (a % b)* c + ((c *b) a) / b
c. compute d = (a / b)* c - ((c %b) a) / b
11. int a = 100; char b; float c = 3.5; int d;
a. compute d = sizeof(a);
b. compute d = sizeof(b);
c. compute d = sizeof(c)
12. Sort the following binary operators in order of high to low precedence: +, -, *, /, %, =.
13. What is printed by the following code snippet? int x1 = 2, y1, x2 = 2, y2; y1 = ++x1; y2 = x2++;
cout << x1 << " " << x2 << ' '; cout << y1 << " " << y2 << ' ';
--x2; y1 = x2++; x1++; y2 = x1--;
cout << x1 << " " << x2 << ' '; cout << y1 << " " << y2 << ' ';
14. What is the value of variables a, b, and c in the program below after the statement 1, 2, and 3. Please fill-up the values of a, b, c in the table given below after each statement (1, 2 and 3) is executed.
int a = 5; int b = 6;
int c;
a = (b++) + 3; // Statement 1
c = 2 * a + (++b); // Statement 2
b = 2 * (++c) - (a++);// Statement 3
15. Consider the following section of C++ code:
#include stdafx.h #include using namespace std;
int main() {
int m = 3, n = 2, x , y;//Variable declarations and initializations x = m + 5; m--;
y = (m + 4)/3;
n = (n--) + 2;
m = m + n/2;
m++;
x = (--x) * 2 - 3;
y = y * 2;
n = n + y * 3;
cout << "m = " << m << endl; // Statement -1 for output printing
cout << "n = " << n << endl; // Statement -2 for output printing
cout << "x = " << x << endl; // Statement -3 for output printing
cout << "y = " << y << endl; // Statement -4 for output printing return 0;
}
What will be the value of variables m, n, x and y as printed in the statement -1, statement -2, statement -3 and statement -4?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started