Page 374 - Computer Science V2.0 Class 11
P. 374
elif x.isupper():
print("upper")
else:
print("all the best")
mixUp("ToP#1")
Ans. alphabet
alphabet
alphabet
all the best
digit
14. What will be the output produced on the execution of the following Python code?
Str = "Now ONLy OFFline"
for x in Str[2:-9]:
print("SCHOOL")
Ans. SCHOOL
SCHOOL
SCHOOL
SCHOOL
SCHOOL
15. What will be the output produced on the execution of the following Python code?
Str = "#Den4"
for ch in Str:
if(ch.isdigit()):
Str = Str[0:3]+'a'
elif 'e' in str:
Str = Str[0:3]+'a'
elif 'P' not in Str:
Str = '9' + Str[1:] + 'z'
else:
Str = Str + '*'
print(Str)
Ans. 9zza
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): A string in Python must be enclosed in double quotes, for example,"hello world"
Reasoning (R): A string cannot be concatenated with a number.
2. Assertion(A): Strings are immutable.
Reasoning(R): Once a string object is created, it cannot be changed.
Ans. 1. b 2. a
360 Touchpad Computer Science (Ver. 2.0)-XI

