Page 287 - Computer Science V2.0 Class 11
P. 287
4. A ______________ statement is a dummy statement which is ignored by the interpreter.
5. The if statement executes a sequence of statement(s) when the conditional expression is ______________.
6. If a single control variable is to be tested for multiple values, each requiring a separate action, an ______________ clause
can be used along with if-else statement.
7. Conditional statements and iterative statements are examples of ______________ statements.
8. In a compound statement, a header clause, that begins with a keyword, includes a conditional expression and ends
with a ______________ .
D. Answer the following questions:
1. Define the flow of control.
Ans. The order of execution of the statements in a program is known as the flow of control.
2. Enumerate three types of flow of control in a program.
Ans. Sequential Flow, Conditional Flow, and Iterative Flow.
3. Enumerate three types of statements in Python.
Ans. Simple, compound, and pass statements.
4. What is a compound statement in Python?
Ans. A compound statement often spans several lines. It comprises one or more header clauses and one or more sequences of
statements, called suites. A header clause begins with a keyword and ends with a colon. A suite may comprise one or more
statements. The suite following a header clause, appears at the next level of indentation.
5. Enumerate different types of conditional statements in Python.
Ans. if, if-else, if-elif-else
6. Write Boolean expressions for the following:
a. shop is 'Spencers' and road is 'M G Road'
b. Either num1 is greater than 20 or num2 is greater than num1
c. age is between 35 and 50 ( 35 and 50 included) and name is not 'Sofia'
Ans. a. shop == 'Spencers' and road == 'M G Road'
b. num1 > 20 or num2 > num1
c. (age >= 35 and age <= 50) and name != 'Sofia'
7. What will be the output produced when the following code segment is executed:
n = 20
if n > 10:
if n > 15:
n = n-15
else:
pass
elif n < 6:
if n != 0:
print('non-zero')
print(n)
Ans. 5
8. Determine the error associated with the following piece of code snippets:
(i) If value == 10:
square = value*value
(ii) if value == 10
square = value*value
Conditional Statements 273

