C Programming Chapter 7

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The ____ operator is used to change an expression to its opposite state. ! && %% ||

!

The logical NOT operator is ____. && %% ! ||

!

Which of the following operators has right to left associativity? ! || && *

!

Which of the following operators has the highest precedence? ! * || &&

!

When the ____ operator is used with two expressions, the condition is true only if both expressions are true by themselves. %% ! && ||

&&

A relational expression consists of a boolean operator that compares two operands.

False

If you inadvertently use an assignment symbol, =, in place of the relational symbol, == in a relational expression, the compiler will flag this with either a warning or error message.

False

In C, character data cannot be compared using relational operators.

False

Indentation used within an if-else is critical to ensure that the code compiles correctly.

False

The expression:(6 * 3 == 36 / 2) && (13 < 3 * 3 + 4) || !(6 - 2 < 5)evaluates to 1.

False

The following statement prints "You lose!" on the screen; int num = -1; if (num) printf("Bingo!"); else printf("You lose!");

False

The switch statement usually results in more complex code than an equivalent if-else chain.

False

Within a selection statement, an expression that evaluates to 0 or less is considered as false, while any positive is considered as true.

False

What will the following program print on screen?int age = 40; if (age = 40) printf("Happy Birthday!"); else printf("Sorry"); Nothing; the program will not compile. Sorry Happy Birthday! Runtime error.

Happy Birthday!

What will the following program print on screen? int tenure = -5; if(tenure+5) printf("Congratulations!"); else printf("Sorry"); Congratulations! Runtime error. Sorry Nothing; the program will not compile.

Sorry

The technique of checking user input data for erroneous or unreasonable data is referred to as ____. if-else chaining robust programming user-friendly programming input data validation

input data validation

A ____ statement is a specialized selection statement that can be used in place of an if-else chain where exact equality to one or more integer constants is required. switch case nested if break

switch

A common practice for some programmers is to place the opening brace of a compound statement on the same line as the if and else statements.

True

A nested if construction in which each nested if is written in the same line as the previous else is called an if-else chain, and is used extensively in many programming problems.

True

Generally, the most useful nested if statement occurs when a second if-else statement is placed within the else part of an if-else statement.

True

In C any expression can be tested within a selection statement, be it a relational, arithmetic, or assignment expression, or even a function call.

True

In a switch statement, if the break statements are omitted, all cases following the matching case value, including the default case, are executed.

True

One of the main advantages of using a switch statement is that it avoids using the equality operator, ==.

True

The ! operator is an unary operator.

True

The && operator has a higher precedence than the || operator.

True

The compiler will, by default, associate an else with the closest previous unpaired if, unless braces are used to alter this default pairing.

True

The evaluation feature for the && and || operators that makes the evaluation of an expression stop as soon as it is definitively determined that an expression is true or false is known as short-circuit evaluation.

True

The use of braces to enclose a set of individual statements creates a single block of statements, which may be used anywhere in a C program in place of a single statement.

True

In a switch statement, the word ____ is optional and operates the same as the last else in an if-else chain. case default break if

default

When an executing program encounters a(n) ____ statement, the condition is evaluated to determine its numerical value, which is then interpreted as either true or false. if else break switch

if

Including one or more if-else statements within an if or if-else statement is referred to as a ____ if statement.

nested

The logical OR operator is ____. && ! || %%

||

When the ____ operator is used with two expressions, the resulting condition is true if either one or both of the two expressions are true. %% ! && ||

||

Which of the following operators has the lowest precedence? && || ! *

||

____ is not a relational operator. > != == ||

||


संबंधित स्टडी सेट्स

Chapter 6; Manufacturing Procurement

View Set

PLT Students as Diverse Learners

View Set

Religious pluralism and theology

View Set

Chemistry: Equilibrium: Equilibrium Constants: Reaction Quotient, Q

View Set