Chapter 4 Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following is evaluated first, given the expression: A && B || C && !D

!D

This operator represents the logical AND:

&&

What will be displayed after the following statements execute? int funny = 7, serious = 15; funny = serious % 2; if ( funny != 1) { funny= 0; serious = 0; } else if ( funny==2) { funny = 10; serious = 10; } else { funny = 1; serious = 1; } cout << funny << " " << serious << endl;

1 1

Given if/else statement: if ( a < 5) b = 12; else d = 30; Which of the following performs the same operation?

a < 5c? b = 12c: d = 30;

Without this statement appearing in a switch construct, the program "falls through " all of the statements below the one with the matching case expression.

break

If you intend to place a block statement within an if statement, you must place ________ around the block.

curly braces { }

After the following code executes, what is the output if user enters 0? int x = -1; cout << " Enter a 0 or 1: "; cin >> x; if (0) cout << "true" << endl; else cout << "false" << endl;

false

These operators connect two or more relational expressions into one, or reverse the logic of an expression.

logical

What is the value of the following expression? true || false

true


Kaugnay na mga set ng pag-aaral

Nutrition for Healthy Life Exam 2 Review Questions

View Set

Organizations that Help Shape Community Health

View Set

Ch. 18 Peripheral Vascular with Lymphatics

View Set