Test Index

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

© examsnet.com
Question : 2 of 37
Marks: +1, -0
Identify the output of the following code snippet :
s = "the Truth"
print(s.capitalize())
Solution:  
Concept:
str.capitalize() returns a copy of the string in which the first character is converted to uppercase and all other characters are converted to lowercase.
Explanation:
'the Truth' → first character 't' becomes 'T'; the rest 'he Truth' becomes 'he truth'.
Output:
The truth
Key point: capitalize() also lowercases the 'T' of 'Truth'. 'The Truth' would be the output of title(), and 'THE TRUTH' of upper().
Answer:
Option A (The truth)
© examsnet.com
Advertisements
Go to Question: