Define Algorithm. Briefly explain the various control structures used in Algorithm.

CS Professional · Information Technology and Systems Audit · PYQS · December 2020
Define Algorithm. Briefly explain the various control structures used in Algorithm.

Answer & Explanation:

Algorithm: An algorithm is a step to step procedure to solve a given problem. It is a sequence of instructions to make a program more readable, a process to answer question. Algorithm can be defined as a sequence of activities to be processed for getting desired output from a given input. To make a computer do anything, one need to write a computer program. To write a computer program, one have to tell the computer, step by step, exactly what he want it to do. The computer then "executes" the program, following each step mechanically, to accomplish the end goal. When one tells the computer what to do, he also gets to choose how it's going to do it. That's where computer algorithms come in. The algorithm can be classified to the three types of control structures. They are: Sequence: The sequence is exemplified by sequence of statements place one after the other - the one above or before another gets executed first. Branching (Selection): The branch refers to a binary decision based on some conditions. If the condition is true, one of the two branches is explored, if the condition is false, the other alternative is taken. Loop (Repetition): The loop allows a statement or a sequence of statements to be repeatedly executed based on some loop condition. It is represented by the 'while' and 'for' constructs in most programming languages, for unbounded loops and bounded loops respectively. The loop is also known as the repetition structure.

Topics: Programming Concepts

Open in Interactive Practice Hub · Full Practice Hub · Chapter Weightage · More in this subject

Related Questions in this Topic