Chapter 2: Problem 34
include
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.
Chapter 2: Problem 34
include
These are the key concepts you need to understand to accurately answer the question.
All the tools & learning materials you need for study success - in one app.
Get started for freeGiven:
int num1, num2, newNum;
double x, y;
Which of the following assignments are valid? If an assignment is not valid,
state the
reason.
When not given, assume that each variable is declared.
a. num1 = 35;
b. newNum = num1 – num2;
c. num1 = 5; num2 = 2 + num1; num1 = num2 / 3;
d. num1 * num2 = newNum;
e. x = 12 * num1 - 15.3;
f. num1 * 2 = newNum + num2;
g. x / y = x * y;
h. num2 = num1 % 2.0;
i. newNum = static_cast
What is the output of the following statements? Suppose a and b are int
variables, c is a double variable, and a = 13, b = 5, and c = 17.5.
a. cout << a + b – c << endl;
b. cout << 15 / 2 + c << endl;
c. cout << a / static_cast
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? a. cout << "x = " << x << ", y = " << y << ", z = " << z << endl; b. cout << "x + y = " << x + y << endl; c. cout << "Sum of " << x << " and " << z << " is " << x + z << endl; d. cout << "z / x = " << z / x << endl; e. cout << "2 times " << x << " = " << 2 *x << endl;
Which of the following is a reserved word in C++? a. Const b. include c. Char d. void e. int f. Return
What is the difference between a keyword and a user-defined identifier?
What do you think about this solution?
We value your feedback to improve our textbook solutions.