Header Ads Widget

Module 03: Introduction to Structured Programming

Introduction to Structured Programming


1. What is Boolean algebra? Mention the evaluating order of Boolean expression.

Boolean Algebra is a form of algebra in which symbols have the values of either “true” or “false”, and are subject to the operations AND, OR, NOT. It is also known as Boolean logic.


2. Define Truth Table. How can we develop a truth table by using AND, OR and NOT logic gate?

Truth table is a tool for analyzing all possible combinations of values of a Boolean expression. Truth table is commonly used to represent the possible values of combinations of condition.

Developing truth table:

i. Set up a column for each condition.

ii. List all possible combinations of conditions, one combination to a row.

iii. Write expressions to be evaluated as a column heading, complex expressions may be subdivided into component parts for ease for ease of evaluation, with each part of a column heading.

iv. Under each of these column heading, with the value of the expressions in the heading for the combination of conditions given for that row.


3. Construct a truth table for four rules.


4. What do you mean by compound condition?

Compound condition means more than one condition combined by means of the Boolean operators AND or OR.


5. Discuss about the sequence checking, restricted value test and miscellaneous other test.

Sequence Checking: Sequence checking is a method for verifying that a file is in order by comparing key fields of constructive records.

Restricted Value: A value applied to an input field to determine if its value is acceptable.

Miscellaneous others test: Depending on the situation, any of a number of other test may be performed on input data. A field that is supposed to be numeric can be checked to determine if in fact it contains numeric characters.


6. What do you mean by EOF? Discuss sentinel value and counter.

EOF: End Of File condition when reading a file.


7. What do you mean by swap? Write a pseudocode for sorting 3 numbers.

Swap: The act of swapping two variables refers to mutually exchanging the values of the variables. Usually, this is done with the data in memory.

Pseduocode for sorting  3 numbers:

IF A<B THEN

                  MOVE A to B

                  MOVE B to A

                  MOVE temp to B

ELSE

                   (null)


END IF

IF A <C THEN

                  MOVE A to temp

                  MOVE C to A

                 MOVE temp C

ELSE

                  (null)

END IF

IF B <C THEN

                 MOVE B to temp

                MOVE C to B

                MOVE temp to C

ELSE

                    (null)

END IF


8. What approaches are followed to develop a truth table?

The approach that is used to develop a truth table is as follows:

i. Set up a column for each condition.

ii. List all possible combinations of condition.

iii. Write each expression to be evaluated as a column heading.

iv. Under each of column heading, write the value of the expression in the heading for the combination of condition given for that row.


9. Truth table is used for what purpose?

The truth table is commonly used to analyze the possible values of combinations of conditions.


10. Explain the more widely used techniques in input editing.

More widely used techniques in input editing are:

i. Sequence checking 

ii. Restricted- value test

iii. Miscellaneous other tests

[See question No. 5]


10. How an error message can be displayed when a sequence error or invalid data is fund?

We must include error routines as part of the program to display the error message when a sequence error or invalid data is found.


11. What techniques are used to detect end of data?

The technique of using a dummy record as sentinel value is used to detect end of data.


12. Develop the truth table for the following expressions:

(i)   (NOT A OR B) OR C

(ii) A AND (B AND NOT C)


13. What is batch processing?

Batch processing is processing in which data is accumulated over a period of time and then processed as a group or batch.


14. What is sentinel value?

Sentinel Value is a specific value placed in a field in  a dummy record to signal the end of the file.


15. Define the following Keywords:

AND: AND is a Boolean operation, as in the statement A AND B, in which the statement is true only if both A and B are true.

Constant: A value that does not change.

Dummy record: A record placed at the end of a file to signal that there is no more data to be processed.

Error routine: Error routines are the instructions that are executed when an error is encountered during processing.

Input editing: Processing that checks the validity of data.

NOT: A Boolean operation, as in NOT A, that changes the value of a statement from true to false or from false to true.

OR: A Boolean operation, as in A OR B , in which the statement is true if either A or B (or both )is true

Parameter: Value used in a program where the value is subject to change and is read in at the time the program is executed.

Restricted-value test: A test applied to an input field to determine if its value is acceptable, e.g., equal to one or several values, or within range of value.

Sentinel value: A specific value placed in a field in a dummy record to signal the end of the file.

Sequence checking: Sequence checking is a method for verifying that a file is in order by comparing key fields of consecutive records.

Simple condition: Simple condition is a single condition that by itself controls a loop or selects one of two alternatives for processing.

Variable: A field whose contents can be changed.


Post a Comment

0 Comments