Page 290 - Computer Science V2.0 Class 11
P. 290
Assertion and Reasoning Based Questions
The following questions are assertion(A) and reasoning(R) based. Mark the correct choice as
a. Both A and R are true and R is the correct explanation of A
b. Both A and R are true and R is not the correct explanation of A
c. A is true but R is false
d. A is false but R is true
1. Assertion(A): In a program, a set of statements may not be executed even once.
Reasoning(R): In the case of the conditional flow of a program, the statements will be executed only if the condition is
True.
2. Assertion(A): Conditional statements and iterative statements are examples of compound statements.
Reasoning(R): Conditional statements are executed only when a particular condition specified in the header clause is
satisfied.
Ans. 1. a 2. b
Case-based Questions
1. Ruhi likes maths as a subject. Now, as she is learning to program in Python, she wants to create a program in Python that
checks whether a number is a multiple of 5 or not. She has written the following program but it is not getting the desired
output. Identify the errors that Ruhi has made in her program.
def divisible(n, k):
'''
Objective: To check divisibility by k
Input Parameters:
n: Number to be tested for divisibility - numeric value
k: divisor - numeric value
Return Value: True/ False - boolean value
'''
if n %5 == 0:
return True
else:
return False
number == int(input('Enter a number : '))
result = divisible(number, 5)
if result == True:
print('Number', number, 'is divisible by 5')
else:
print('Number', number, 'is not divisible by 5')
Ans. • Assignment operator should be used in place of ==.
• The if block and else block are not indented correctly
276 Touchpad Computer Science (Ver. 2.0)-XI

