Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Problem 15

Suppose \(\mathbf{x}, \mathbf{y},\) and \(\mathbf{z}\) are int variables and \(\mathbf{w}\) and \(\mathbf{t}\) are double variables. What value is assigned to each of these variables after the last statement executes? x = 23; y = 35; x = x + y / 4 - 3; z = x % 3; w = 28 / 3 + 6.5 * 2; t = x / 4.0 + 15 % 4 - 3.5;

Problem 16

Suppose \(\mathbf{x}, \mathbf{y},\) and \(\mathbf{z}\) are int variables and \(\mathbf{x}=2, \mathbf{y}=5,\) and \(\mathbf{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;

Problem 17

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(b) + 2 * c << endl; d. cout << 14 % 3 + 6.3 + b / a << endl; e. cout << static_cast(c) % 5 + a – b << endl; f. cout << 13.5 / 2 + 4.0 * 3.5 + 18 << endl;

Problem 19

Which of the following are correct \(\mathrm{C}++\) statements? a. cout \(<<\) "Hello there!" \(<<\) endl b. cout \(<<\) "Hello"; \(<<\) " There! \("<<\) endl c. cout \(<<\) "Hello" \(<<\) " There! \("<<\) endl d. cout \(<<\) 'Hello There!' \(<<\) endl

Problem 20

Give meaningful identifiers for the following variables: a. A variable to store the first name of a student. b. A variable to store the discounted price of an item. c. A$variable to store the number of juice bottles. d. A variable to store the number of miles traveled. e. A variable to store the highest test score.

Problem 21

Write C++ statements to do the following: a. Declare int variable num1 and num2. b. Prompt the user to input two numbers. c. Input the first number in num1 and the second number in num2. d. Output num1, num2, and 2 times num1 minus num2. Your output must identify each number and the expression.

Problem 23

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; }

Problem 24

include using namespace s… # The following program has syntax errors. Correct them. On each successive line, assume that any preceding error has been corrected. #include using namespace std; int main() { int temp; string first; cout << "Enter first name: ; cin >> first cout << endl; cout << "Enter last name: ; cin >> last; cout << endl; cout << "Enter today's temperature: "; cin >> temperature; cout << endl; cout << first << " " << last << today's temperature is: "; << temperature << endl; return 0;

Problem 25

What action must be taken before a variable can be used in a program?

Problem 26

c. \( d. ! e. None of these. # Preprocessor directives begin with which of the following symbols: a. * b. # c. \) d. ! e. None of these.

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Get Vaia Premium now
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks