MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Python
Python Coding Interview
Quiz 1
1
2
3
4
5
6
7
8
9
10
Q.1
What will be the output of the following Python code? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman']>>>print(names[-1][-1])
a) A
b) Daman
c) Error
d) n
Q.2
What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman']names2 = names1names3 = names1[:] names2[= 'Alice'names3[= 'Bob' sum = 0for ls in (namesnamesnames3): if ls[== 'Alice': sum += if ls[== 'Bob': sum +=print sum
a) 11
b) 12
c) 21
d) 22
Q.3
Suppose list1 is [2], What is list1 * 2?
a) [2, 6, 4]
b) [1, 3, 2, 1, 3]
c) [1, 3, 2, 1, 3, 2]
d) [1, 3, 2, 3, 2, 1]
Q.4
Suppose list1 = [0.5 * x for x in range(4)], list1 is:
a) [0, 1, 2, 3]
b) [0, 1, 2, 3, 4]
c) [0.0, 0.5, 1.0, 1.5]
d) [0.0, 0.5, 1.0, 1.5, 2.0]
Q.5
What will be the output of the following Python code? >>>list1 = [23]>>>list2 = [2]>>>list1 < list2
a) True
b) False
c) Error
d) None
Q.6
To add a new element to a list we use which command?
a) list1.add(5)
b) list1.append(5)
c) list1.addLast(5)
d) list1.addEnd(5)
Q.7
To insert 5 to the third position in listwe use which command?
a) list1.insert(3, 5)
b) list1.insert(2, 5)
c) list1.add(3, 5)
d) list1.append(3, 5)
Q.8
To remove string “hello” from listwe use which command?
a) list1.remove(“hello”)
b) list1.remove(hello)
c) list1.removeAll(“hello”)
d) list1.removeOne(“hello”)
Q.9
Suppose list1 is [5], what is list1.index(5)?
a) 0
b) 1
c) 4
d) 2
Q.10
Suppose list1 is [3], what is list1.count(5)?
a) 0
b) 4
c) 1
d) 2
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page