Lesson 1 Flashcards
algorithm
a set of ordered and finite steps to solve a given problem.
flowchart
graphical representation of an algorithm
decision tables
a more compact and readable format for presenting an algorithm
program
sets of precise and complete instructions to accomplish a task
syntax
vocabulary and grammar in a language
class
set of data and methods
variables
provide temporary storage during the execution of a program
constants
data fields or local variables whose value cannot be modified.
array
collection of items in which each item can be accessed by using a unique index.
operators
symbols that specify which operation to perform on the operands before returning a result.
methods
code blocks containing a series of statements. Methods can receive input via arguments and can return a value to the caller. If a method were to return a value, the appropriate data type for the return value would be used instead of “void.”
decision structures
introduce decision-making ability into a program. They enable you to branch to different sections of the code depending on the truth value of a Boolean expression.
C# decision-making control structures:
“if,” “if-else,” and “switch” statements.
if statement
will execute a given sequence of statements only if the corresponding Boolean expression evaluates to true.
if-else statement
allows your program to perform one action if the Boolean expression evaluates to true, and a different action if the Boolean expression evaluates to false.
switch statement
allows multi-way branching. They can often simplify a complex combination of if-else statements.
C# control structures for repetitive tasks:
the while loop, the do-while loop, the for loop, and the foreach loop
examples of control transfer statements which transfer control outside the loop:
break, goto, return, and throw
statement to pass control to the next iteration of the loop without exiting the loop:
continue statement
while loop
repeatedly executes a block of statements until a specified Boolean expression evaluates to false.
general form of the while loop:
while (boolean test)
statement
three main parts of a while loop:
- Initializer
- Loop test
- Termination expression
do-while loop
repeatedly executes a block of statements until a specified Boolean expression evaluates to false. The do-while loop tests the condition at the bottom of the loop.
general form of the do-while loop:
do
statement
while (boolean test);