Unit 2 Flashcards

Control Structures (9 cards)

1
Q

algorithm

A

a set of instructions or a procedure for solving a problem and the order in which the actions should execute

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

pseudocode

A

“fake” code that is easy to understand by everyone

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

flowchart

A

a diagram that displays the sequential order of steps and the flow of logic in a program

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

selection/decision statments

A

if, else, else if, switch
* if a condition is met, the block of code under the statement would be executed

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

repetition/iteration statements

A
  • sentinel-controlled/conditional loops
  • counter-controlled/counted loops
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

sentinel-controlled/conditional loops

A

an action that is to be repeated while some condition remains true
* while → condition is tested for first
* do-while → code will be executed first, then the condition is tested at the end
* break → will stop executing the code at a certain point
* continue → will continue executing the code and will not jump out of the condition

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

counter-controlled/counted loops

A

when the number of repetitions is known before the loop begins executing
* for loops → a while loop all in one line
* e.g. for (int num - 1; num < totalNum; num++)
* counter, condition, incrementation

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

brute-force

A

a programming style where programs are written in a tedious and repetition-heavy method

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

nesting

A

placing one control structure within another control structure

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