Recall & Review
beginner
What is control flow in programming?
Control flow is the order in which individual instructions, statements, or function calls are executed or evaluated in a program.
Click to reveal answer
beginner
Why do we need control flow in a program?
Control flow lets a program make decisions, repeat actions, and choose different paths, so it can solve different problems and react to different inputs.
Click to reveal answer
beginner
How does an if statement affect control flow?
An if statement checks a condition and directs the program to run certain code only if the condition is true, changing the normal top-to-bottom execution.
Click to reveal answer
beginner
What happens when a loop is used in control flow?
A loop repeats a block of code multiple times, directing the program to go back and run the same code again until a condition is met.
Click to reveal answer
beginner
Give an example of control flow directing execution in R.
Using an if-else statement: if (x > 0) { print("Positive") } else { print("Not positive") } directs the program to print different messages based on x's value.
Click to reveal answer
What does control flow control in a program?
✗ Incorrect
Control flow controls the order in which the program's instructions are executed.
Which R statement directs execution based on a condition?
✗ Incorrect
The if statement checks a condition and directs execution accordingly.
What does a loop do in control flow?
✗ Incorrect
Loops repeat a block of code until a condition is met.
Why is control flow important?
✗ Incorrect
Control flow lets programs choose paths and repeat actions.
Which of these is NOT a control flow structure?
✗ Incorrect
Variable assignment sets values but does not direct execution flow.
Explain in your own words why control flow is important in programming.
Think about how a program can do different things based on conditions.
You got /4 concepts.
Describe how an if statement changes the normal flow of a program.
Consider what happens when a condition is true or false.
You got /4 concepts.