The entire playlist of videos can be found here for your review and convenience.
Video 01 – Overview of Control Structures
Watch the video, Video 01 – Overview of Control Structures (17:51), and answer the following questions.
What theorem states that the logic of your program can be broken down into three standardized patters?
Structured Program Theorem
What is a control structure?
A control structure is a program that takes some variables and then decides what to do with them based on the instructions given
List and describe the function of the three control structures:
1) Sequence : one step follows another
2) Selection : depending on the imput, one of several things can happen
3)Iteration : similiar to selection, its just its possible for one of the options to repeat.
How is selection used in iteration?
The repititiion part of iteration is a sequence
Video 02 – Boolean Expressions
Watch the video, Video 02 - Boolean Expressions (17:05), and answer the following questions.
What theorem states that the logic of your program can be broken down into three standardized patters?
Structured Program Theorem
What is a control structure?
A control structure is a program that takes some variables and then decides what to do with them based on the instructions given
What are the possible outcomes of evaluating a Boolean expression?
True/False
What type of operators allow us to form large, complex Boolean expressions?
Logical Operators
Fill in the table for the Boolean expressions below and provide a values for undeclared variable(s) that will cause the expressions to evaluate TRUE. You can assume that each expression along with the provided declarations/assignments are executed in different programs and therefore have no effect on each other: (I have done the first one for you as an example)
Expression
Undeclared Variable
Value
int intAppleCount = 7;
intAppleCount++ <= intApplesInPie int intApplesInPie =
8;
int intTotal = 5;
intTotal >= intCutOff int intCutOff =
4;
double dblAverage = 105.37; double dblDeviation = 1.2;
(dblGrade-dblAverage) != dblDeviation double dblGrade=
100000
string strStatus = “Busy”;
strStatus != “Available” && ++intEmailsToday >=4
int intEmailsToday =
4
string strStatus = “Available”;
strStatus != “Available” | ++intEmailCount >=4 int intEmailCount =
1;
Video 03 – If Statements in C#
Watch the video, Video 03 – if Statements in C# (10:55), and answer the following questions.
How many else if statements can you put in an else if chain? No limit. When are the statements associated with an else statement executed?
When none of the if statements are activated Provide the output that would result from executing the code snippets below. Assume that the code snippets exist in different programs. If there is no output, put as single space in the answer box.
Code Snippet
Output
int intMyAge = 22; //in years int intAgeOfMilk = 22; //in years
//Check the age of milk found in cellar if (intAgeOfMilk >= intMyAge)
{
Console.WriteLine(“DON’T DRINK THAT!?!”);
}
“DON’T DRINK THAT!?! double dblIncome = 65000; double dblTaxRate = 0;
//find the appropriate income bracket and set tax rate if (dblIncome >= 15000 && dblIncome < 25000)
{
dblTaxRate = 0.10;
}
else if (dblIncome >= 15000 && dblIncome < 25000)
{
dblTaxRate = 0.15;
}
else if (dblIncome >= 15000 && dblIncome < 25000)
{
dblTaxRate = 0.2;
}
else
{
dblTaxRate = 0.25;
}
//Display Tax rate to user via the console as a percent value