CS 159 Lab 6 True or False

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/48

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.

49 Terms

1
New cards

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

T

2
New cards

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

T

3
New cards

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

T

4
New cards

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

T

5
New cards

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

F

6
New cards

The logical OR (||) operator is true when one or both of its operands is true.

T

7
New cards

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

F

8
New cards

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

T

9
New cards

The short-circuit method of evaluating logical expressions will stop evaluating the current expression as

soon as the result can be determined.

T

10
New cards

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

T

11
New cards

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

F

12
New cards

The complement of the greater than operator is the less than or equal to operator.

T

13
New cards

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

be 1.

T

14
New cards

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

T

15
New cards

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

T

16
New cards

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

construct.

T

17
New cards

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

T

18
New cards

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

T

19
New cards

The conditional expression is a two-way selection construct.

T

20
New cards

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

operators within.

T

21
New cards

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

T

22
New cards

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

F

23
New cards

One way to complement a NOT operator is with another NOT operator the other is not having any NOT operators.

T

24
New cards

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

frequently.

T

25
New cards

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

T

26
New cards

3 && -3 && 10 && -10

T

27
New cards

3 || -3 || 10 || -10

T

28
New cards

3 || 6 && 0

T

29
New cards

3 == 4 || 6 || 8

T

30
New cards

3 == 3 && -1 && 1

T

31
New cards

6 % 2 || 7 % 2

T

32
New cards

The complement of x > 3 is x <= 3

T

33
New cards

The following two logical expressions are equivalent for all integer (int) values of x:

!(x < 10) and x >= 10

T

34
New cards

The following two logical expressions are equivalent for all non-negative integer (int) values of x:

x % 2 and x % 2 != 0

T

35
New cards

The complement of

x % 3 == 0 || x % 3 == 2

is

x % 3 != 0 && x % 3 != 2

for all non-negative integer (int) values of x.

T

36
New cards

The complement of

x > 0 && x < 10 || y + 2 == 0

is

x <= 0 || x >= 10 && y + 2 != 0

F

37
New cards

The compiler will issue a warning when an assignment operator rather than the equality operator is used as

the logical expression of an if condition.

T

38
New cards

It is a course standard to make use of { and } with all if-else constructs.

T

39
New cards

It is a course standard to indent all code within the body of a selection construct two additional spaces.

T

40
New cards

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

F

41
New cards

The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one logical operator.

T

42
New cards

Evaluate the following expression: 0 || 3 && 6

T

43
New cards

It is a course standard to make use of { and } with all if-else constructs.

T

44
New cards

(a != 0) and !(a == 0) are complementary logical expressions (the variable a is an integer).

F

45
New cards

The logical expression of an if...else construct does not require enclosure in parentheses.

F

46
New cards

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

T

47
New cards

The complement of x >= 3 is x <= 3

F

48
New cards

(a != 0) and (a) are complementary logical expressions (the variable a is an integer).

F

49
New cards

The logical OR operator is true only when exactly one of its operands is true.

F

Explore top flashcards