Selective control structure only
Loop control structure only
Both option (A) and (B)
switch case control structure only
Answers
Answer:
Control structures form the basic entities of a “structured programming language“. We all know languages like C/C++ or Java are all structured programming languages. Control structures are used to alter the flow of execution of the program. Why do we need to alter the program flow ? The reason is “decision making“! In life, we may be given with a set of option like doing “Electronics” or “Computer science”. We do make a decision by analyzing certain conditions (like our personal interest, scope of job opportunities etc). With the decision we make, we alter the flow of our life’s direction. This is exactly what happens in a C/C++ program. We use control structures to make decisions and alter the direction of program flow in one or the other path(s) available.
There are three types of control structures available in C and C++
1) Sequence structure (straight line paths)
2) Selection structure (one or many branches)
3)Loop structure (repetition of a set of activities)
All the 3 control structures and its flow of execution is represented in the flow charts given below.
Control statements in C/C++ to implement control structures
We have to keep in mind one important fact:- all program processes can be implemented with these 3 control structures only. That’s why I wrote “control structures are the basic entities of a structured programming language“. To implements these “control structures” in a C/C++ program, the language provides ‘control statements’. So to implement a particular control structure in a programming language, we need to learn how to use the relevant control statements in that particular language.
The control statements are:-
Switch
If
If Else
While
Do While
For
Answer:
thank you for asking this question