
Python - String and Lists
Authored by Anik Acharjee
Computers
Professional Development
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str1 = "Hello World"
result = ""
for char in str1:
if char.isalpha():
result += char.lower()
else:
result += char
print(result)
What will be the output of the above code?
hello world
HELLO WORLD
Hello World
hELLO wORLD
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str2 = "Python is awesome"
result = ""
for i in range(len(str2)):
if i % 2 == 0:
result += str2[i].upper()
else:
result += str2[i].lower()
print(result)
What will be the output of the above code?
PyThOn iS AwEsOmE
pYtHoN iS AwEsOmE
PYTHON IS AWESOME
PytHon Is aWesoMe
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str3 = "12345"
result = ""
for char in str3:
result += str(int(char) * 2)
print(result)
What will be the output of the above code?
246810
13579
Typecasting Error
12345246810
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str4 = "Good Morning"
result = ""
for char in str4:
if char.isalpha():
result += char
print(result)
What will be the output of the above code?
Good Morning
GdMrng
Morning
GoodMorning
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str5 = "abcdefg"
result = ""
for i in range(len(str5)):
if i % 2 != 0:
result += str5[i]
print(result)
What will be the output of this code?
bdfg
aceg
abcdefg
bdf
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
my_list = [1, 2, 3, 4, 5]
if len(my_list) > 3:
result = my_list[:3]
else:
result = my_list[::-1]
print(result)
What will be the output of the above code?
[1, 2, 3]
[5, 4, 3, 2, 1]
[1, 2, 3, 4, 5]
[1, 2]
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
my_list = [1, 2, 3, 4, 5]
if sum(my_list) > 20:
result = my_list[-1] * 2
else:
result = my_list[2]**2 + my_list[-2]**2
print(result)
What will be the output of this code?
7
10
25
2
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
20 questions
Révision HTML, CSS et JavaScript
Quiz
•
Professional Development
15 questions
BrightChamps Technical Round - C language
Quiz
•
Professional Development
20 questions
QUIZ-5 static, String and StringBuffer
Quiz
•
Professional Development
20 questions
CSTC- In-House Review (Activity 1)
Quiz
•
Professional Development
20 questions
CPA JYSS 2018 Prelims Paper 1
Quiz
•
7th Grade - Professio...
20 questions
Chapter 3 : Flowchart & Pseudocode
Quiz
•
Professional Development
15 questions
HTML
Quiz
•
Professional Development
16 questions
ERUDITE
Quiz
•
Professional Development
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