CS 159 Lab 6

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

23 Terms

1
New cards

A piece of data is called logical if it conveys the idea of true or false.

true

2
New cards

C programmers use other types, such as integers, to represent logical data.

true

3
New cards

If a data value is zero it is considered false, but any non-zero value is considered true.

true

4
New cards

The logical AND (&&) operator is true only when both operands are true.

true

5
New cards

The logical OR (||) operator is true only when exactly one of its operands is true

false; could be both are true

6
New cards

The AND and OR operator share the same level of operator precedence.

false; AND is higher

7
New cards

The short-circuit method of evaluating logical expressions will stop evaluating the current expression as soon as the result can be determined.

true

8
New cards

Relational Operators

less than, greater than, <=, >=; higher precedence than the equality operators

9
New cards

Equality Operators

==, !=; lower precedence than relational

10
New cards

The complement of the equal operator is the not equal operator.

true

11
New cards

The complement of the greater than operator is the less than operator.

false; less than equal to operator

12
New cards

When attempting to print the result of a logical expression that is true as an integer the result will always be 1.

true

13
New cards

The logical expression of an if...else construct must be enclosed in parentheses.

true

14
New cards

There is no semi-colon that follows the logical expression of an if...else construct.

true

15
New cards

The statements found inside of an if...else may be any statement, including another if...else construct.

true

16
New cards

if(a != 0) and if(!a) are equivalent statements.

false; complements

17
New cards

if(a == 0) and if(a) are equivalent statements.

false; complements

18
New cards

The conditional expression is a two-way selection construct

true

19
New cards

Negative logic refers to any expression that begins with a NOT operator or that contains multiple NOT operators within.

true

20
New cards

Complementing a condition is one way to potentially remove negative logic from an expression.

true

21
New cards

The only way to complement a NOT operator is with another NOT operator

false

22
New cards

When writing a selection construct the most probable conditions should come before those that occur less frequently.

true

23
New cards

It is possible to indicate on a structure chart when a user-defined is called from within a section construct.

true