Test Index

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

© examsnet.com
Question : 4 of 37
Marks: +1, -0
What is the output of the following expression ?
Sports="Paralympic Games"
print (Sports.split("m"))
Solution:  
Concept:
str.split(sep) breaks the string at every occurrence of sep, removes the separator and returns the pieces as a list.
Explanation:
"Paralympic Games" contains 'm' twice: Paralympic Games.
Pieces: 'Paraly', 'pic Ga', 'es'.
['Paraly', 'pic Ga', 'es']
Key point: split() drops the separator and returns a list. Keeping 'm' and returning a tuple with three parts is what partition("m") does (and only at the first 'm').
Answer:
Option D (['Paraly','pic Ga','es'])
© examsnet.com
Advertisements
Go to Question: