Completed
Class 11 CS – Strings & String Functions Challenge
Questions From This Challenge
Q1mcq1 mark
What will be the output? s = "COMPUTER" print(s[1:7:2], s[-2::-3])
OPT EPC ✓
OPU EPM
OMT EPC
OPT ECP
Q2mcq1 mark
What will be the output? s = "programming" print(s.count("r"), s.find("gram"), s.index("ming"))
2 3 7 ✓
2 2 7
1 3 6
2 4 7
Q3mcq1 mark
What will be the output? s = "Python" print(s[:3] + s[-2:] * 2)
Pythonon
Pythono
Pytonon ✓
PytPython
Q4mcq1 mark
What will be the output? s = " Data Science " print(len(s), len(s.strip()), len(s.lstrip()))
16 12 14 ✓
16 13 14
15 12 13
16 14 12
Q5mcq1 mark
What will be the output? s = "banana" s = s.replace("a", "o") print(s, s.count("o"))
bonono 3 ✓
bonana 1
bonono 2
banana 3
Q6mcq1 mark
What will be the output? s = "Python Programming" print(s.lower().count("p"), s.upper().startswith("PY"))
1 True
2 True ✓
2 False
1 False
Q7mcq1 mark
What will be the output? s = "abc123" print(s.isalnum(), s.isalpha(), s.isdigit())
True False False ✓
True True False
False True False
False False True
Q8mcq1 mark
What will be the output? s = "HELLO123" print(s.isupper(), s.islower(), s.isalpha())
True False True
True False False ✓
False True False
True True False
Q9mcq1 mark
What will be the output? s = "Python:Programming:Language" x = s.partition(":") print(x[0], x[2])
Python Programming
Python Programming:Language ✓
Python:Programming Language
Python Programming Language
Q10mcq1 mark
What will be the output? s = "one,two,,four" x = s.split(",") print(x, len(x), x[2])
['one', 'two', 'four'] 3 four
['one', 'two', '', 'four'] 4 ✓
['one', 'two', '', 'four'] 3
['one', 'two', 'four'] 4 four
Q11mcq1 mark
What will be the output? s = "abcabcabc" print(s.find("abc", 1))
0
1
3 ✓
6
Q12mcq1 mark
What will be the output? s = "MISSISSIPPI" print(s.count("SS"), s.find("ISS"))
2 1 ✓
3 1
2 2
3 2
Q13mcq1 mark
What will be the output? s = "COMPUTER" result = "" for ch in s: if ch.lower() in "aeiou": result = result + ch print(result)
OUE ✓
OUEA
COMPUTER
UE
Q14mcq1 mark
What will be the output? s = "Python" result = "" for i in range(0, len(s), 2): result = result + s[i] print(result.upper())
PYT
PTO ✓
PTOH
PYTHON
Q15output1 mark
What will be the output?
s = " Python Programming "
s = s.strip()
s = s.replace("Python", "Java")
print(s.title())
Correct output:
Java Programming