Test Index

CBSE Class 12 Computer Science 2026 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 20 of 37
Marks: +1, -0
Assertion (A): The upper() function/method in Python returns the string with all lowercase letters of the given string converted to uppercase.
Reason (R): Strings are mutable objects in Python.
Solution:  
Concept:
s.upper() returns a new string with lowercase letters changed to uppercase; the original string is not changed because strings are immutable.
Explanation:
s = 'Hello'
t = s.upper()
print(t) # HELLO
print(s) # Hello
Assertion: true.
Reason: false. Strings are immutable; s[0] = 'J' gives a TypeError.
Answer:
Option C (Assertion (A) is true, but Reason (R) is false.)
© examsnet.com
Advertisements
Go to Question: