Python - String and Lists
Quiz
•
Computers
•
Professional Development
•
Medium
Anik Acharjee
Used 6+ times
FREE Resource
Enhance your content
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
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
Advanced JavaScript
Quiz
•
Professional Development
20 questions
Python
Quiz
•
Professional Development
16 questions
DECI - Week 13 - round
Quiz
•
Professional Development
20 questions
MS Excel Basics
Quiz
•
5th Grade - Professio...
20 questions
Cyber Security
Quiz
•
Professional Development
15 questions
image processing quiz2
Quiz
•
University - Professi...
20 questions
File Extensions
Quiz
•
9th Grade - Professio...
15 questions
Kelas X 28 Spreadsheet 2020
Quiz
•
Professional Development
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade