Conditional Control Structures in C++

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

flashcard set

Earn XP

Description and Tags

Flashcards covering selection, iteration, and jump statements in C++ conditional control structures, based on lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

What are the three major categories of conditional control structures in C++?

Selection statements, Iteration statements, Jump statements.

2
New cards
3
New cards

Name the selection statements available in C++.

If statement, If Else Statement, If Else If statement, Nested If statement, Switch statement.

4
New cards

What is the purpose of control structures in programming?

To alter the flow of program execution based on conditions, enabling decision making.

5
New cards

What are iteration statements also known as?

Loops or looping statements.

6
New cards

List the three kinds of loops in C++.

For loop, While loop, Do While loop.

7
New cards

What is an If statement used for?

To execute a set of statements when the condition evaluates to true.

8
New cards

What is the syntax of an If statement?

if (expression) { Statements }.

9
New cards

What happens when the condition in an If statement is true?

The statements inside the if block execute.

10
New cards

What is an If Else statement?

A conditional branching statement that executes the 'if' part when true, otherwise executes the 'else' part.

11
New cards

What is the syntax of If Else?

if (expression) { Statements } else { Statements }.

12
New cards

What is an If Else If statement?

An extension of If Else to check additional conditions when previous ones are false.

13
New cards

What is the syntax of If Else If?

if (expression) { Statements } else if (expression) { Statements } else if (expression) { Statements }.

14
New cards

What is a Nested If statement?

An if statement placed inside another if statement to check multiple conditions.

15
New cards

What is a Switch statement and its behavior?

Switch compares an expression against case constants and executes the matching case; uses break to end a case; default runs if no match.

16
New cards

What is the syntax of a Switch statement?

switch (expression) { case constant: Statements break; … default: Statements; break; }.

17
New cards

What is a For loop?

An iteration that runs a block of code with initialization, condition, and increment: for (init; condition; increment) { … }.

18
New cards

What is a While loop?

An entry-controlled loop that executes while the condition is true.

19
New cards

What is a Do While loop?

An exit-controlled loop that executes the block at least once, then tests the condition.

20
New cards

What is a Return statement?

Stops execution of a function and returns control to the caller; may return a value if the function is non-void.

21
New cards

What is a Goto statement used for?

Unconditional transfer of control to a labeled statement elsewhere in the code.

22
New cards

What is the exit() function in C++?

Terminates program execution and returns a code to the OS; 0 indicates success, non-zero indicates error.

23
New cards

What is the Break statement and where is it used?

Break terminates the current loop or switch case immediately.

24
New cards

What is the Continue statement used for?

Skips the rest of the current loop iteration and continues with the next iteration.

25
New cards

What is the difference between break and continue?

Break ends the loop or switch entirely; continue skips to the next iteration within the same loop.

26
New cards

What is an entry controlled loop?

A loop (like while) that tests the condition before each iteration.

27
New cards

What is an exit controlled loop?

A loop (like do-while) that tests the condition after the iteration.