FINALS Flashcards
(42 cards)
are commands that enable a program to “take decisions”, following one path or another.
Control Structures
Control Structures are commands that enable a program to ____________ , following one path or another.
“take decisions
These are the blocks that analyze variables and choose directions in which to go based on given parameters.
Control Structures
3 types of Control Structures
Conditional Structures (or Selection)
Iteration Structures (or Looping)
Selective Structures (switch)
Conditional operator
(? :)
are used to execute one or more statements if a condition is met.
Conditionals (or Selection)
4 types of Conditional Structures
if statements
if else statements
if else if statements
Nested if statements
execute one or more statements when a condition is met. If the testing of that condition is TRUE, the statement gets executed. But if it’s FALSE (the condition is not met), then nothing happens.
If statements
This Control Structure allows a program to follow alternative paths of execution, whether a condition is met or not.
If else statements
can have multiple alternative statements.
If-else if statements
is an if statement that is the target of another if statement.
nested if
Use the s____________ to select one of many code blocks to be executed.
Switch statement
Multiple – Selection Structure
Switch
The switch expression is evaluated how many times?
once
The ______ and ________ keywords are optional.
break and default
When C++ reaches a _________ keyword, it breaks out of the switch block.
break
This will stop the execution of more code and case testing inside the block.
break
This is a keyword that specifies some code to run if there is no case match.
default
refers to Switch statements inside of another Switch Statements.
Nested-Switch statements
Other word for Looping stuctures?
Iterative or Repetition
There may be a situation when you need to execute a block of code several number of times.
Looping Structures (Iterative, Repetition)
In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.
Looping Structures (Iterative, Repetition)
allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages.
A loop statement
Types of Looping Statements
while Loop (Pretest loop)
do while Loop (Post-test loop)
for Loop (Counter-controlled loop)