Chapter 4 Quiz

Ace your homework & exams now with Quizwiz!

the operator takes an operand and reverses its truth or falsehood

!

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

!D

the operator represents the logical AND

&&

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

0

when a relational expression is false, it has the value

0

What is the output of the following code? int w = 98; int x = 99; int y = 0; int z = 1; if (x >= 99) { if (x < 99) cout << y << endl; else cout << z << endl; } else { if (x == 99) cout << x << endl; else cout << w << endl; }

1

what is assigned to the variable result given the statement below with the following assumptions: x = 10, y = 7, and x, result, and y are all int variable result = x >= y;

1

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

the ______ is an equality (or comparison) operator

==

given the if/else statement: if (a<5) b = 12; else d = 30;

a < 5 ? b = 12: D = 30;

input values should always be checked for

all of these

which statement allows you to properly check the char variable code to determine whether it is equal to a C and then output This is a check?

if (code == 'C') cout << "This is a check\n";

this statement uses the value of a variable or expression to determine where the program will branch to

switch

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 to the ______ portion of an if/else if statement

trailing else

what is the value of the following expression? true && !false

true

the operator represent the logical OR

||


Related study sets

intro to crim final exam study guide

View Set

Interior and Exterior Angles of Polygons equations

View Set

Biology Chapter 6: Chromosomes and Cell Division

View Set

Introduction to Java Programming: Ch. 5 quiz

View Set

Why was there a revolution in Iran 1979?

View Set

Chapter 14: Assessing Skin, Hair, and Nails

View Set