C++ Chapter 4

Ace your homework & exams now with Quizwiz!

This operator represents the logical AND

&&

Given the following code segment, what is output after "result = "? Int x = 1, y = 1, z = 1; Y = y + z; X = x + y; Cout << "result = " << (x < y ? y : x) << endl;

3

If you place a semicolon after the statement: If (x < y)

The complier will interpret the semicolon as null statements.

What is the output of the following code segment? Int x = 5 If (x = 2) Cout << "This is true!" << endl; Else Cout << "This is false!" << end1; Cout << "This all folks!" << endl;

This is true! This is all folks!

True / False: You should be careful when using the equality operator to compare floating point values because of potential round- off errors.

True

True/ False: If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.

True

What is the value of the following expression? true && true

True

5. What will the following segment of ode output? Assume the user enters a grade of 90 from the keyboard. Cout << "Enter a test score: "; Cin >> test_score; If (test_score < 60); Cout << "You failed the test!" << endl; If (test_score > 60) Cout << "You passed the test!" << endl; Else Cout << "You need to study for the next test!";

You failed the test! You passed the test!

The default section of a switch statement performs a similar task as the __ portion of an if/else if statement.

trailing else

Which of the following expressions will determine whether x less than or equal to y

x <= y


Related study sets

Human Resource Management- Chapter 6

View Set

Linux Chapter 5 - Linux Filesystem Administration

View Set

Ch. 12 Southeast Asians and Pacific Islanders

View Set

7th Grade World History| 11.01: Romantic Art in an Age of Revolution

View Set

Chapter 38: Assessment: Gastrointestinal System

View Set

Nursing Informatics midterm Chap 1

View Set

Chapter 31 Patients with Hypertension, MedSurg Chapter 31, Patho Test 1 - ATI questions

View Set