Home > Python > Quizzes > PYTHON Practice Test - Intermediate Level
PYTHON Practice Test - Intermediate Level
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 26% Most missed: “Is the following piece of code valid?”
PYTHON Practice Test - Intermediate Level
Time left 00:00
21 Questions

1. What will be the output? names1 = ['Amir', 'Bala', 'Charlie'] names2 = [name.lower() for name in names1] print(names2[2][0])
2. Is the following piece of code valid? a=2,3,4,5 a
3. What is the output of the following? print([i.lower() for i in HELLO"])"
4. Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
5. What is the output of the code shown below? import math [str(round(math.pi)) for i in range (1, 6)]
6. What will be the output? names1 = ['Amir', 'Bala', 'Charlie'] names2 = [name.lower() for name in names1] print(names2[2][0])
7. What is the output of the code shown below? s=set([1, 2, 3]) s.union([4, 5]) s|([4, 5])
8. What is the output of the following code? a,b=6,7 a,b=b,a a,b
9. What is the output of the following piece of code? a=list((45,)*4) print((45)*4) print(a)
10. What is the output of the following code? import copy a=[10,23,56,[78]] b=copy.deepcopy(a) a[3][0]=95 a[1]=34 print(b)
11. What is the output of the following code? import copy a=[10,23,56,[78]] b=copy.deepcopy(a) a[3][0]=95 a[1]=34 print(b)
12. What will be the output? d = {\"john\":40, \"peter\":45} d[\"john\"]
13. What is the output of the line of code shown below, if s1= {1, 2, 3}? s1.issubset(s1)
14. Is the following piece of code valid? a=2,3,4,5 a
15. What will be the output? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for lst in values: for element in lst: if v > element: v = element print(v)
16. What is the output of the following piece of code when executed in the python shell? a={1,2,3} a.intersection_update({2,3,4,5}) a
17. Which of the following statements is used to create an empty set?
18. What is the output of the line of code shown below, if s1= {1, 2, 3}? s1.issubset(s1)
19. Suppose list1 is [1, 3, 2], What is list1 * 2?
20. Which of the following lines of code will result in an error?
21. What is the output of the following piece of code? a=list((45,)*4) print((45)*4) print(a)