Chapter 4 Flashcards Preview

Programming Fundamentals > Chapter 4 > Flashcards

Flashcards in Chapter 4 Deck (24)
Loading flashcards...
1

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

relational operators

2

exp formed by relational operators

relational exp

3

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

Boolean expression

4

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

sequence structure

5

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

decision structure

6

action performed only when a certain condition exists

conditionally executed

7

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 ___

if statement

8

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

if/else statement

9

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.

if/else if statement

10

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

trailing else

11

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

flag

12

used to combine 2 or more relational exps into one

logical operators

13

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

logical AND operator (&&)

14

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

short circuit evaluation

15

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

logical OR operator (||)

16

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)

logical NOT operator (!)

17

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

menu-driven program

18

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

input validation

19

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

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

20

what can be used in integer exp of switch statement

1) variable of any integer data type, including char
2) exp whose value is of any integer data types

21

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

constant exp

22

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

case

23

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

default

24

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

break