NEW
Font size
WorksheetsCAI625 Practice Quiz
Total questions: 10
Worksheet time: 6mins
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
[3, 5, 20, 5, 25, 1, 3]
[3, 4, 5, 20, 5, 25, 1, 3]
[1, 3, 3, 4, 5, 5, 20, 25]
[1, 3, 4, 5, 20, 5, 25]
What data type is the object below ?
L = [1, 23, 4, 1]
List
Array
Dictionary
Node
What is the output of the following command?
print ("Hello World"[:-1])
Hello World
Hello Worl
d
Error
What is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
8
16
Indentation Error
Runtime Error
Suppose list1 is [2, 33, 222, 14, 25], which of the following will print 25?
print(list1[25])
print(list1[5])
print(list1[:-1])
print(list1[-1])
What will be the output of the following Python code?
list1 = [1,2,3,4,5]
list2 = [6,7]
list1.extend(list2)
print(list2)
[6, 7]
[1,2,3,4,5]
[1, 2, 3, 4, 5, 6, 7]
Error
What will be the output of the following Python code?
list1 = [1,2,3,4,5]
list2 = [6,7]
list1.extend(list2)
print(list1)
[6, 7]
[1,2,3,4,5]
[1, 2, 3, 4, 5, 6, 7]
Error
Which of the following statements create a dictionary?
d = {}
d = {“Ali”:40, “Salem”:45}
d = {40:”Ali”, 45:”Salem”}
All of the mentioned
What will be the output of the following Python code snippet?
d = {"Tareq":40, "Salem":45}
print(d["Tareq"])
40
45
2
Salem
If a={5,6,7}, what does a become when a.add(5) is executed?
{5,5,6,7}
a={5,6,7}
5
Error as 5 already exists in the set
