Page 293 - Computer Science V2.0 Class 11
P. 293
2. Which of the following statements will result in an error?
a. if(2):
print('ABCD')
b. if(0):
print('ABCD')
c. if(2, 0):
print('ABCD')
d. if(2)
print('ABCD')
3. What will be the output produced on execution of the code given below if the values of a and b are 10 and -5 respectively?
a = 10
b = -5
if a%2!=0 or a+b>0:
print('You are through')
else:
print('Try Again')
a. You are through
b. Try Again
c. No Output
d. Error
4. Which of the following statements is correct?
a. An if statement should always have an else block
b. Only one elif block can be executed in the entire if statement
c. Once the statements in the if block are executed, the control moves out to the statements in elif block.
d. There can be multiple else blocks in a single if statement at the same level of nesting.
5. Consider the following statement and choose the correct option:
if ch>'A' and ch<='Z':
print('Hello')
a. 'Hello' will be printed if the value of ch is an upper case alphabet other than 'A' and 'Z'.
b. 'Hello' will be printed if ch is not an upper case alphabet.
c. 'Hello' will be printed if ch is an upper case alphabet except 'A'.
d. 'Hello' will be printed if ch is an upper case alphabet except 'Z'.
6. Which of the following statements will result in an error?
a. if value!=10:
print('Hello')
b. if value and 10:
print('Hello')
c. if value==10:
print('Hello')
d. if value=10:
print('Hello')
B. State whether the following statements are True or False:
1. A sequence of statements may be executed multiple times in a program. ________
2. A program in Python must have a sequential flow. ________
Conditional Statements 279

