W3 - LOGIC Flashcards
W3-1 What is STRUCTURED PROGRAMMING? (SP)
_ is a programming PARADIGM aimed at improving the clarity, quality, and development time of a computer programming
_ SP consists of sets of simple CONSTRUCTS, each of which has 1 ENTRY point and 1 EXIT point.
W3-2 SEQUENTIAL CONSTRUCTS represent?
one statement follows another and the statements are executed in order
- SELECTION constructs and ITERATION constructs represent MODIFICATIONS of sequential constructs.
W3-2 SELECTION CONSTRUCTS represent?
different paths through the sets of instructions
W3-3 ITERATION CONSTRUCTS represent?
REPETITION of the SAME set of instructions until a specified condition has been met.
W3-4 To complete a programming language, how many classes of constructs are required?
3 classes of constructs:
1/ SEQUENTIAL CONSTRUCTS
2/ SELECTION CONSTRUCTS
3/ ITERATION CONSTUCTS
W3-5 What is the SIMPLEST example of a STRUCTURED construct?
_ a sequence
_ A sequence is either a SIMPLE STATEMENT or a CODE BLOCK
W3-6 What is a CODE BLOCK?
_ is a set of STATEMENTS enclosed in a pair of curly braces to be executed sequentially.
_ Unlike a SINGLE STMT, a C CODE BLOCK does not require a TERMINATING semi-colon of its own (after the closing brace)
W3-7 Well-established techniques include?
_ pseudo-coding
_ flow-charting
=> improve chances are that our coding will be clear and concise
W3-8 What is a PSEUDO-CODE?
is a set of shorthand NOTES in a human (non-programming) language that itemizes the KEY steps in the sequence of instructions that produce a programming solution.
W3-9 What is a FLOW CHART?
is a set of conventional SYMBOLS connected by arrows that illustrate the FLOW of control through a programming solution.
W3-10 The C language supports 3 SELECTION CONSTRUCTS?
_ OPTIONAL path (OP)
_ ALTERNATIVE paths (AP)
_ CONDITIONAL expression (CE)
W3-11 OPTIONAL PATH executes?
_ a SEQUENCE only if a certain condition is satisfied; that is, if the condition is TRUE.
_ OPTIONAL selection takes the form
if (condition)
sequence
- Parentheses enclose the condition, which may be a RELATIONAL expression or a LOGICAL expression
- The sequence may be a SINGLE STMT or a CODE BLOCK
W3-12 C language supports 2 ways of describing ALTERNATIVE PATHS?
_ an binary select construct
_ a multiple selection construct
W3-13 BINARY SELECTION CONSTRUCT executes?
_ one of a set of ALTERNATIVE SEQUENCES
_ Construct takes the form if (condition) sequence else sequence
- Parentheses enclose the condition, which may be a RELATIONAL expression or a LOGICAL expression
- The sequences may be SINGLE STMTs or CODE BLOCKS
- (P) executes the sequence following the IF only if the condition is TRUE
- (P) executes the sequence following the ELSE only if the condition is FALSE
W3-14 MULTIPLE SELECTION
For 3 alternative paths
=> append an IF ELSE construct to the ELSE keyword