Part 1: Theoretical Questions
Q.1. what is control structure?
A statement used to control the flow of execution in a program or function is called control
structure.
یسکرپورگالاینشکنفںیملمعدرآدمےکاہبؤوکرٹنکوكرکےنےکےیلاامعتسكوہےنواالایبمرٹنکوكڈاھہچنالہکاتےہ۔
The control structures in C are used to combine individual instruction into a single logical
unit.
ںیمرٹنکوكڈاھےچنوکارفنادیدہاایتوکاکیوادحیقطنمااکیئںیموجڑےنےکےیلاامعتسكایکاجاتےہ۔C
The logical unit has one entry point and one exit point.
یقطنمویٹنںیماکیارٹنیوپاٹنئاوراکیازگیٹوپاٹنئوہاتےہ۔
Q.2. List different types of control structures for writing programs.
The basic control structures for writing programs are sequence structure, selection structure
and repetition structure.
ااختنبیکاستخاوررکتاریکاستخںیہ۔،رپورگالےنھکلےکےیلاینبدیرٹنکوكڈاھہچنرتبیتیکاستخ
Q.3. Write three selection statements and three repetition statements.
The selection statements are if, if-else and switch.
ںیہ۔switchاورif, if-elseااختنبےکایبانت
The repetition statements are while, do-while and for.
ںیہ۔forاورdo-while،whileدرہاےئاجےنواےلایبانت
Q.4. When you must use curly braces { } with a selection or repetition statement?
The curly braces are required if selection or repetition statement has multiple statements in
body.
وھگرھگبایلینحنموطخطودحاینیکرضورتےہارگااختنبایرکتارایبمےکابڈیںیمدعتمدایبانتوہں۔
Q.5. How are instructions executed in sequence structure?
In sequence structure, the instructions are executed in the same order in which they are
specified in the program.
دہاایتوکایسرتبیتںیمانذفایکاجاتےہسجںیموہرپورگالںیمایبمےیکےئگںیہ۔،رتبیتےکڈاھےچنںیم
The control flows from one statement to other in a logical sequence.
رٹنکوكیقطنمرتبیتںیماکیایبمےسدورسےںیماتہبےہ۔
Q.6. Define flowchart.
A flowchart is the graphical representation of a program.
ولفاچرٹاکیرپورگالیکوصترییامندنئیگےہ۔
Q.7. What is a condition?
A condition is an expression that evaluates to true (1) or false (0).
)اکادنازہرکاتےہ۔0()ایطلغ1(رشطاکیااسیااہظرےہوجدرتس
Q.8. Which structure is used to execute a statement repeatedly?
A repetition structure executes a statement or set of statements repeatedly.
رکتاراکڈاھہچناکیایبمایایبانتےکٹیسوکابرابرااجنلداتیےہ۔
It is also known as iteration structure or loop.
اےسرکتارڈاھہچنایولپےکانلےسیھباجاناجاتےہ۔
Composed by: M. Umair Nasir
, Unit No.11 2
The repetition Structures include for loop, while loop and do-while loop.
ل ہکولپاوررکو ول ولپلمہ ںیہ۔،رکتارےکڈاھےچنںیمولپےکےیل
Q.9. How does a selection structure select a Statement to execute?
A selection structure selects a Statement or set of statements to execute on the basis of a
condition.
ااختنباکڈاھہچنیسکرشطیکاینبدرپلمعرکےنےکےیلاکیایبمایایبانتاکٹیسبختنمرکاتےہ۔
In this structure, a statement or set of statements is executed when a particular condition is
true and ignored when the Condition is false.
اکیایبمایایبانتاکومجمہعاسول لمعںیمالایاجاتےہبجوکیئاخصرشطدرتسوہیتےہاوربجرشططلغوہیتےہوتاےس رظادنازایکاجاتےہ۔،اسڈاھےچنںیم
Q.10. What do you know about “if” statement?
if is a keyword in C language.
یسزابمںیمدیلکیظفلےہ۔if
if statement is a decision-making statement.
ایبمہلصیفاسزیاکایبمےہ۔if
It is the simplest form of selection Constructs.
ہیااختنبرٹسنکسٹکیکبسےسآاسملکشےہ۔
It is used to execute or skip a statement or set of statements by checking a condition.
ہییسکرشطیکاجچنرکےکایبمایایبانتےکٹیسوکااجنلدےنیایوھچڑےنےکےیلاامعتسكوہاتےہ۔
Q.11. Define compound statement.
A set of statements written in curly brackets {} is called compound statement.
وھگرھگبایلوطخطودحاینںیمےھکلےئگایبانتاکومجمہع{}رمبکایبمالہکاتےہ۔
Q.12. What is the use of “if-else” statement?
if-else statement is another type of if Statement.
ایبمیکاکیاورمسقےہ۔if ایبمif-else
It executes one block of statement(s) when the condition is true and the other when it is false.
ہیایبانتےکاکیالبکوکاسول ااجنلداتیےہبجرشطدرتسوہاوردورسابجہیطلغوہ۔
In any Situation, one block is executed and the other is skipped.
اکیالبکوکاھپیسندیاجیتےہاوردورسےوکوھچڑدایاجاتےہ۔،یسکیھبوصرتاحكںیم
Q.13. Write the Syntax of “if-else” statement.
if(condition)
statement;
else
statement;
Q.l4. What is the use of “if-else-if” statements?
if-else-if statement can be used to choose one block of statements from many blocks of
statements.
اٹنمٹیٹسوکایبانتےکیئکالبسکںیمےسایبانتےکاکیالبکوکبختنمرکےنےکےیلاامعتسكایکاج اتکےہ۔if-else-if
It is used when there are many options and only one block of statements should be executed
on the basis of a condition.
ہیاسول اامعتسكوہاتےہبجتہبےساایتخراتوہںاوررشطیکاینبدرپایبانتےکرصفاکیالبکوکلمعںیمالایاجےئ۔
Composed by: M. Umair Nasir