click below
click below
Normal Size Small Size show me how
03 mod 5
| Question | Answer |
|---|---|
| It refers to the order in which a program’s statements are executed | Flow of control |
| Any algorithm can be built using combinations of four standardized flow of control structures: | sequential, Selection, Repetition, Invocation |
| Normal flow of control for all programs is __________ | sequential |
| It is used to select which statements are performed next based on a condition | Selection |
| It is used to repeat a set of statement | Repetition |
| It is used to invoke a sequence of instructions using a single statement, as in calling a function | Invocation |
| Also known as conditions | Relational expression |
| The expression is interpreted as either true (non-zero) or false (0). | Relational expression |
| < > <= >= == != | Relational expression |
| >= | Relational expression |
| grade >= 70 What is grade and 70 in the expression? | Operand |
| Character data can also be compared using relational operators | True |
| AND (&&), OR (||), and NOT (!) | Logical expressions |
| This statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false | if statement |
| One of the important functions of the if statement is that it allows the program to select an action based upon the __________ | user's input |
| If, if-else, if-ladder, nested if | if statement |
| The structure of an if statement: | single statement, compound statement |
| if ( expression ) statement_TRUE; else statement_FALSE; | Structure of if statement |
| if ( expression1 ) statement1 ; else if ( expression2 ) statement2 ; else statement3 ; | The structure of an if-ladder statement |
| How is if statement excused? | Up to down |
| An if or ifelse statement inside another if statement | Nested if statements |
| Allows a variable to be tested for equality against a list of values | Switch statement |
| What is each value in switch statement called? | Case |
| switch(expression) { case constant1 : statement(s); break; case constant2 : statement(s); break; case constantn : statement(s); break; default : /* Optional */ statement(s); | Structure of switch statement |
| Do not use floats in switch statements. | True |
| Expression evaluated by switch should match a case | True |
| This means that the matching case must also be an integer or a constant expression which evaluates to an integer | True |
| Letters (not words) can be used in case statements as constants | True |
| Use break statement to stop further execution otherwise it continues execution with whatever code that follows | True |
| executed if no case constant-expression value is equal to the value of expression | Default in switch statement |
| C++ provides control structures that serve to specify what has to be done to perform our program | True |
| It is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions | program |
| It is a group of instructions separated by semicolons (;) but grouped in a block delimited by curly bracket signs: { and }. | block of instructions |
| The general decision making capability in C++ is provided by the ______ | if statement |
| It is a series of statements places inside curly braces {}. When the if statement is true, then all the statements inside the {} are run. | program block, or compound statement |
| f (expression); // ends with semicolon | False |
| The ______ structures can be concatenated with the intention of verifying a range of values. | if + else |
| Occur when if statements appear inside other if statements. | Nested if statements |
| The______ part of an if construct permits the implementation of multi-way branch decisions. | else if |
| Selective structure | Switch |
| To implement multi-way decisions the __________ provides a more concise representation than multiple else if statements, which can get very difficult to follow. | switch statement |
| More than three statements | switch statement |
| The switch statement is a multi-way decision that tests whether an expression matches one of a number of constant integer values. | True |
| you stop execution of any further statements by using a ____________. This breaks out of the switch statement and continues execution with whatever code follows the closing brace of the switch. | break statement |
| It allows for statements that should be carried out when none of the specific case situations match. This may not be too clear at the moment, but the following examples should help | default |
| s block of instructions 1 until it finds the break keyword, then the program will jump to the end of the switch selective structure | Switch |