Chapter 4 Flashcards

(24 cards)

1
Q
>
<
>=
<=
==
!=
used to compare numeric data; binary; L to R associativity
A

relational operators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

exp formed by relational operators

A

relational exp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

value can only be T or F; if operands don’t meet meaning of operand, exp if false; another name for relational exps

A

Boolean expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

prgm where statements are executed in sequence, w/out branching off in another direction

A

sequence structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

prgrm where some statements are only executed under certain circumstances; a specific action is only taken when a specific condition exists

A

decision structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

action performed only when a certain condition exists

A

conditionally executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

one way to code a decision structure; if exp inside () is true, the very next statement or block is executed; otherwise, it’s skipped; condly executed statement should appear on line after ___ and should be indented one level from ___

A

if statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

expansion of another statement; an exp is evaluated, if T, statement/block is executed, if F, a separate group of statements is executed; leads program to execute 1 of 2 exclusive paths

A

if/else statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

makes certain types of nested logic simpler to write; if exp_1 is T, it’s executed and rest are ignored, otherwise, if exp_2 is T, it’s executed and rest of structure is ignored, etc.

A

if/else if statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

the last ___ clause in an if/else if statement that doesn’t have an if statement following it; optional; can be used to catch errors

A

trailing else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

typically a bool variable that signals when some condition exists in the prgm; when set to F, it indicates cond doesn’t exist; when set to T, it means cond exists

A

flag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

used to combine 2 or more relational exps into one

A

logical operators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

takes 2 exps as operands and creates exp that’s true when both sub-exps are true; can be used w/ if statements to condly print cout statement; exps must be on both sides of operator; can be used to simplify prgrms that would otherwise be nested if statements; can be used to det if # is inside range

A

logical AND operator (&&)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

if exp on left side of logical operator that reqs two operands is F, the exp on right side won’t be checked

A

short circuit evaluation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

takes 2 exps as operands and creates an exp that’s T when either of them are T; complete exps must be used on both sides; can use to det if # is outside range

A

logical OR operator (||)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

takes an operand and reverses its truth or falsehood if exp is T, returns F, and if exp is F, returns T; is equivalent to asking is something is not something (if..not)

A

logical NOT operator (!)

17
Q

allows user to det course of action by selecting it from a list of actions; can use if/else statements or if/else if statements to set up a menu or switch statements

A

menu-driven program

18
Q

process of inspecting data given to prgm by user and deting if its ___ (e.g.: checking if in correct range or mathematicall possible)

A

input validation

19
Q

tests value of an integer exp and uses that value to det which set of statements to branch to

A

switch statement [switch(IntegerExp) … case ConstantExp: … case ConstantExp … default: ]

20
Q

what can be used in integer exp of switch statement

A

1) variable of any integer data type, including char

2) exp whose value is of any integer data types

21
Q

must be of an integer data type, may be literal or integer named constant; can’t be a variable or relational exp

22
Q

marks beg of section of statements; prgm branches to these statements if value of switch exp matches that of __ exp

23
Q

optional section that comes after case statements; prgrm branches to this section if none of case exps match switch value; fcns like trailing else

24
Q

come in line following each case statement; show prgm where to stop executing block of statements for case; not needed in default section, but you can put one there; can be strategically omitted to allow fall thru, which enables to branch to same set of statements for multiple exps or to actually print all below statements