Selection Flashcards

1
Q

sequence

A

a list of commands executed one after another, they are executed in the order in which they are placed within the program

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

selection

A

execution of one set of comments if some criterion is true, or another set if the criterion is false

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

repetition (loop)

A

a group of statements is repeated multiple times

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

invocation

A

a group of statements is invoked (by a call) at any place in the program to another program or sub- program

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

relational operators

A

make comparisons; results in ‘true’ (1) or ‘false’ (0)

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

logical operators

A

combine comparisons to make compound conditions

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

list of relational operators

A
< less than
= greater than or equal to
> greater than
== equal to 
~= not equal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

logical operators

A

& and
| or
~ not

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

short-circuit

A

The second operand is evaluated only when the result is not fully determined by the first operand; it will “short circuit” past the second operand if the first one works

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

&&

A

means and, DOES short circuit

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

|

A

means or, DOES short circuit

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

if

end

A
form:
if comparison
     statements
end
if the comparison evaluates to true, carry out statements. if the comparison evaluates to false, skip statements and continue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

if
else
end

A
carries out an alternate set of statements (else) if the first comparison (if) evaluates to false
if comparison
   statements
else
   statements
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

if
elseif
else
end

A
for more complex situations with multiple selection criteria:
if comparison
   statements
elseif comparison
   statements
else
   statements
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

switch/case

A

allows choice between multiple criteria which must be exactly true
switch variable
case option1, option1
statements if variable==option1, option2

case otherwise
statements executed if variable ~= any option
end
NOTE: once a true has been found, other cases are not evaluated.

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

try/catch

A
designed to trap errors 
try
    code block
catch
    code block 
end
if an error occurs in the try block, the program does not quit but runs the catch block instead
17
Q

menu

A

used with switch/case structure
causes a menu box to appear on the screen with a series of predefined buttons
this means only desired actions may be selected; the otherwise function of the switch/case structure isn’t necessary

18
Q

pseudo code

A

verbal description of planning code

a set of comments describing steps taken to solve a problem/ carry out a code

19
Q

flow chart

A

graphical approach to planning code

oval: beginning of section of code
parallelogram: input or output; user interaction with program
diamond: decision point
rectangle: calculations

20
Q

find( )

A

searches a matrix and identifies which elements in the matrix meet a given criteria
NOTE: find returns index numbers of the elements found; their positions, NOT their values