
Python String Operations and Methods
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
DHANESH ABRAHAM
Used 2+ times
FREE Resource
Enhance your content in a minute
100 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
s = "cbse@2024"
count = 0
for char in s:
----if char.isdigit():
--------count += 1
print(count)
3
4
5
9
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
s = "Python"
result = ""
for i in range(len(s)):
------if i % 2 == 0:
---------result += s[i].upper()
-- - - else:
----------result += s[i].lower()
print(result)
"pYtHoN"
"PyThOn"
"PYTHON"
"pYtHon"
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
s = "hello PYTHON"
new_s = ""
for char in s:
----if char.islower():
------new_s += char.upper()
----elif char.isupper():
------new_s += char.lower()
----else:
-------new_s += ' '
print(new_s)
"HELLO python"
"HELLO*PYTHON"
"hELLO*python"
"HELLO*python"
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of len(" Python ".strip())?
10
8
6
4
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method converts the first character of a string to uppercase and the rest to lowercase?
title()
upper()
capitalize()
casefold()
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If s = "InDiA", what will s.title() return?
"INDIA"
"india"
"InDia"
"India"
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the key difference between str.find() and str.index()?
find() searches from the end, while index() searches from the beginning.
index() returns -1 if the substring is not found, while find() raises a ValueError.
find() returns -1 if the substring is not found, while index() raises a ValueError.
There is no difference; they are aliases for the same method.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
96 questions
Информатика
Quiz
•
9th - 12th Grade
102 questions
HTML Basics Quiz
Quiz
•
12th Grade
99 questions
Trắc nghiệm về sửa chữa máy tính
Quiz
•
12th Grade
100 questions
Quiz: Servidores Web
Quiz
•
12th Grade
100 questions
PreTest Informatika 1
Quiz
•
9th - 12th Grade
101 questions
Units 10, 11, 12 Revision Quizzizz
Quiz
•
12th Grade
105 questions
O Level M1 R5 Mix 100 MCQ Set 1
Quiz
•
12th Grade
101 questions
M1 R5 Test 12
Quiz
•
12th Grade
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade
Discover more resources for Computers
8 questions
2 Step Word Problems
Quiz
•
KG - University
10 questions
Martin Luther King, Jr. For Kids
Interactive video
•
1st - 12th Grade
10 questions
Dr. King's Speech and Its Impact
Interactive video
•
7th - 12th Grade
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
7 questions
Anti-Bullying ARS 15-341
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
15 questions
TSI Math Practice Questions
Quiz
•
8th - 12th Grade
24 questions
Identify Properties of Polygons and Quadrilaterals
Quiz
•
9th - 12th Grade
