Chapter 6 Algorithms and Flowcharts Solutions
Question - 1 : - Write the alternate name of infinite loop.
Answer - 1 : -
endless loop.
Question - 2 : - Define looping
Answer - 2 : -
Looping is repeating a s t of instructions until a specific condition is met
Question - 3 : - Write the difference bets een finite and infinite loop.
Answer - 3 : -
A finite loop ends itself. An infinite loop will not end without an outside cause.
Question - 4 : - Is for loop pretest type of loop ?
Answer - 4 : -
Yes. The second clause (the condition) is evalu-ated before each iteration through a loop.
Question - 5 : - Define Variable.
Answer - 5 : -
It is the name of space inside computer memory walues can be stored.
Question - 6 : - Define infinite loop.
Answer - 6 : -
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over.
Question - 7 : - Give an example for infinite loop
Answer - 7 : -
A simple example of an infinite loop is instructing a computer to keep on adding 0 to 1 until 2 is reached. This will never happen.
Question - 8 : - What is a logical operator ?
Answer - 8 : -
Logical operator is a operator used to combine relational expressions. In C++, there are three types of logical operators :
(i) Logical AND
(ii) Logical OR
(iii) Logical NOT
Question - 9 : - Explain Modular programming.
Answer - 9 : -
(i) Modular programming is the technique which divides the entire program into smaller modules, which perform a specific task.
(ii) It can often be used in variety of applications and functions with other components of the system.
(iii) The order in which the modules are executed by the computer is controlled by the main program. This describes fully the procedures required in the solution to a problem. The procedures are written in the order of the machine execution.
(iv) OPP is compatible with the modular programming concept to a large extent. Modular Programming enables multiple programmers to divide up the work and debing pieces of the program independently.
Question - 10 : - What is the difference between modular programming and structured programming ?
Answer - 10 : -
Modular programming : It is the act of designing and writing programs as interactions among functions that each perform a single well defined function & which have minimal side effect interaction between them. It is heavily procedural. The focus is entirely on writing code (functions). Data is passive. Any code may access the contents of any data structured passed to it.
Object Oriented programming : it is a programming using “objects”-data structures consisting of data fields & methods together with their interactions to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism/and inheritance.