Ch 7 Flashcards Preview

Foundations > Ch 7 > Flashcards

Flashcards in Ch 7 Deck (65)
Loading flashcards...
1

And

If both operators are true, condition is true
If either or both are false, condition is false.

2

Or

The condition is false only if both operands are false

3

Not

If the operand is true, condition is false

4

Truth table

Can determine the value of any complex Boolean expression
2n combinations of true and false for n operand la

Can be used anytime there is uncertainty about meaning of if statement

5

Precedence of logical operators

Not has high precedence like other unary operators
And and or have low precedence, with or below and

6

Boolean equivalences

Used to rewrite condition in a more understandable form

7

!(p || q) Equivalent to

!p && !q

8

!(p && q) equivalent to

!p || !q

9

P || (q && r) equivalent to

(P || q) && (p || r)

10

P && (q || r) equivalent to

(P && q) || (p && r)

11

Short circuit evaluation

When JVM knows the value if a Boolean expression before evaluation it's parts, it doesn't evaluate the parts

When evaluation stops as soon as possible

12

Short circuit evaluation of and and or

And: stops at first false value
Or: stops at first true value

13

Three logical operators used in..

Boolean expressions that control the behavior of if, while, and for statements

14

Quality assurance

Process of making sure software is developed to highest standards given constraints of time and money

15

Complete code coverage

What test data should try to a achieve
When all lines of code are tested at least once
Not the same as testing all logical paths

16

Equivalence class

All the sets of test data that exercise a program in the same manner

17

Boundary conditions

Test data that assesses a program's behavior on or near the boundaries between equivalence classes

18

Extreme conditions

Data at the limits of validity

19

Nested if statement

An alternative to using logical operators in a complex program

20

Extended/multiway if statement

If-else in an else statement

21

Errors in nested if statements

Misplaced braces
Removing braces (Java pairs else with closest preceding if)
Lack of braces with if followed by more than one statement
Better to overuse braces than underuse

22

Avoiding nested if statements

Sometimes helps to avoid logical errors
Rewrite as a series of independent if statements

23

Nested loop

Loop inside another loop

24

Frequently, loops iterate

0, 1, or more than one time depending on inputs

Test data should test all 3 possibilities

25

Combinatorial explosion

Multiplicative growth in test cases; guarantees impossibility of exhaustively testing large complex programs

26

Multiplicative growth

Number of parts * number of test data sets

27

Robust program

Program that tolerates and recovers from errors in user input

Must test using invalid data

28

Best way to write robust programs

Check user inputs immediately on entry and reject those that are invalid

29

Arithmetic overflow

When computers memory can't represent a number from arithmetic operation

30

Loop verification

Proceeds of guaranteeing that a loop performs its intended task, independent of testing