
Python Code Output Quiz
Authored by Kanyanut HOMSAPAYA
English
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
56 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? l=[1, -2, -3, 4, 5] def f1(x): return x<-1 m1=map(f1, l) print(list(m1))
[False, False, False, False, False]
[False, True, True, False, False]
[True, False, False, True, True]
[True, True, True, True, True]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? a=[10,23,56,[78]] b=list(a) a[3][0]=95 a[1]=34 print(b)
[10,34,56,[95]]
[10,23,56,[78]]
[10,23,56,[95]]
[10,34,56,[78]]
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? a="hello" b=list((x.upper(),len(x)) for x in a) print(b)
[('H', 1), ('E', 1), ('L', 1), ('L', 1), ('O', 1)]
[('HELLO', 5)]
[('H', 5), ('E', 5), ('L', 5), ('L', 5), ('O', 5)]
Syntax error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
10
[1,3,5,7]
4
[1,3,6,10]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? a=[[]]*3 a[1].append(7) print(a)
Syntax error
[[7], [7], [7]]
[[7], [], []]
[[],7, [], []]
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? b=[2,3,4,5] a=list(filter(lambda x:x%2,b)) print(a)
[2,4]
[ ]
[3,5]
Invalid arguments for filter function
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Python code? lst=[3,4,6,1,2] lst[1:2]=[7,8] print(lst)
[3, 7, 8, 6, 1, 2]
Syntax error
[3,[7,8],6,1,2]
[3,4,6,7,8]
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?