Chapter 4

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

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;

0 0

What is the value of donuts after the following statement executes? int donuts = 10; if (donuts != 10) donuts = 0; else donuts += 2;

12

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!" << endl; cout << "That's all, folks!" << endl

This is true! That's all folks by not putting 'x == 2' the variable was simple reassigned

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

curly braces { }

When a program lets the user know that an invalid choice has been made, this is known as:

input validation

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

the compiler will interpret the semicolon as a null statement

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

trailing else

This operator represents the logical OR:

| |

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

logical


Kaugnay na mga set ng pag-aaral

Islam and Christianity in Dialogue Midterm

View Set

eunsik chang exam 1 review homework questions 1-4

View Set

Geography U.S. and Canada Chapter 6

View Set

Quiz 4: Nominal & Effective Interest Rates

View Set

Nations, Nationalities, and the Capitals.

View Set